Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic drain set #17

Open
zakarumych opened this issue Oct 4, 2017 · 6 comments
Open

Atomic drain set #17

zakarumych opened this issue Oct 4, 2017 · 6 comments

Comments

@zakarumych
Copy link
Member

zakarumych commented Oct 4, 2017

It would be cool to have an BitSetLike which supports add_atomic as AtomicBItSet do but also drain_atomic which will unset all set bits yield their ids.
Implementation should be similar to AtomicBItSet except of using Ordering::Release in add_atomic. While draining it should swap mask with 0 using Ordering::Acquire and move to the next level for each bit set (yield at lowest level).

@zakarumych
Copy link
Member Author

I need this for efficient implementation of futures::executor::Notify

@kvark
Copy link
Member

kvark commented Oct 5, 2017

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.

@zakarumych
Copy link
Member Author

zakarumych commented Oct 5, 2017

@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...

@kvark
Copy link
Member

kvark commented Oct 5, 2017

Hmm, that might be the case. Associated const sounds good to me.

@torkleyy
Copy link
Member

torkleyy commented Dec 9, 2017

@omni-viral Do you still need this?

@zakarumych
Copy link
Member Author

I don't need it now. But it may be useful for those who use futures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants