Open zakarumych opened 7 years ago
I need this for efficient implementation of futures::executor::Notify
We could have the ordering known to AtomicBitSet
and just have different constructors for different order guarantee, without creating a new type and duplicating code.
@kvark wouldn't it slow down execution? If ordering is statically known compiler may remove all unused match arms and so mathing itself.| If we could put it into type level. By trait with associated const...
Hmm, that might be the case. Associated const sounds good to me.
@omni-viral Do you still need this?
I don't need it now. But it may be useful for those who use futures.
It would be cool to have an
BitSetLike
which supportsadd_atomic
asAtomicBItSet
do but alsodrain_atomic
which will unset all set bits yield their ids. Implementation should be similar toAtomicBItSet
except of usingOrdering::Release
inadd_atomic
. While draining it should swap mask with0
usingOrdering::Acquire
and move to the next level for each bit set (yield at lowest level).