Split out synchronization from is_initialized#74
Closed
pitdicker wants to merge 7 commits intomatklad:masterfrom
pitdicker:split_acquire_from_is_initialized
Closed
Split out synchronization from is_initialized#74pitdicker wants to merge 7 commits intomatklad:masterfrom pitdicker:split_acquire_from_is_initialized
pitdicker wants to merge 7 commits intomatklad:masterfrom
pitdicker:split_acquire_from_is_initialized
Conversation
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is based on top of #72, only the last two commits are relevant.
Before using
MaybeUninitthere were two ways to check whether aOnceCellwas initialized:is_initialized, which had the side effect of acquiring the value.Some, which didn't do any synchronization.After #72 we just always call
is_initialized. I would like to bring back the distinction:fn sync_getwill check if it is initialized, acquire and return the valuefn is_initializedwill only check if it is initialized, without synchronizing.This is the only change I would need to the
syncmodule to be able to add an experimental implementation using consume. Do you think it makes sense on its own? And is the change small enough not to bother duplicating thesyncmodule?The last commit is optional. It seems nice if
initializewould returnvalue. This prevents an unnessecaryunwrapinget_or_try_init, for which the code used an unsafeget_uncheckedbefore to prevent.