Implement Once type for pthread_once like functionality
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
Fixes #54042
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.
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?
Superseded by https://github.com/JuliaLang/julia/pull/55793