Add const constructors to RwLock
, Notify
, and Semaphore
.
#2833
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.
Referring to the types in
tokio::sync
.Also add
const
tonew
for the remaining atomic integers insrc/loom
(except for 64bit which is impossible) and toUnsafeCell
.Motivation and Solution
Builds upon previous work in #2790.
Closes #2756.
This PR adds
const_new
tosync::Notify
,sync::RwLock
, andsync::Semaphore
, in addition to the previously added one forsync::Mutex
as they can all be reasonably be used instatic
variables and this saves the need for (and overhead of) something likelazy_static
in the case thatparking_lot
already is used internally anyways.Also, upon encountering the problem of missing
const
forAtomicU8
insrc/loom
(used inNotify
), I decided (also for consistency) to addconst
to all the constructors for the remaining types in that directory, whereas #2790 only addedconst
tonew
forAtomicUSize
.