julia icon indicating copy to clipboard operation
julia copied to clipboard

Implement Once type for pthread_once like functionality

Open gbaraldi opened this issue 1 year ago • 3 comments

This is a way to start the discussion. It uses a very pthread_once API. We might want to go fancier and also maybe move the callback to inside the struct. I'm not sure what do people prefer

gbaraldi avatar Aug 09 '24 20:08 gbaraldi

Fixes #54042

nsajko avatar Aug 09 '24 22:08 nsajko

One important design question still left is. What happens if we error here. IMO we should set a flag that this failed and error. The flag would also make anyone else that calls this also error. Hopefully avoiding executing code in a bad state.

gbaraldi avatar Aug 10 '24 00:08 gbaraldi

One important design question still left is. What happens if we error here. IMO we should set a flag that this failed and error. The flag would also make anyone else that calls this also error. Hopefully avoiding executing code in a bad state.

Perhaps we actually store the error? So anybody who comes along later can be thrown the same error instead of just a generic thing?

quinnj avatar Aug 10 '24 03:08 quinnj

Superseded by https://github.com/JuliaLang/julia/pull/55793

maleadt avatar Nov 06 '24 12:11 maleadt