-
Notifications
You must be signed in to change notification settings - Fork 31
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
Bounded queue #160
Bounded queue #160
Conversation
This PR is nearly complete, but there are a few points to address:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good! I'm curious if the memory cost of the counter/capacity
fields is worth the reduced contention on a shared Atomic? But at the same time, I'm in awe with how smart that technique is :) ... Perhaps one thing to consider (document?) is that TSan users will get "false" data-race reports that they will need to silence ( https://ocaml.org/manual/5.2/tsan.html#s:tsan-runtime-flags )
- I agree that
Cue
is a cute name, but thatBounded_queue
orQueue_bounded
would be more appropriate - I think it's expected that the
_unsafe
variant will be faster with no special need to document it
…ementaiton. Still seg fault.
Following PR #83, this PR adds a bounded queue but non-blocking (like in PR #83) to avoid adding
Picos
as a dependency toSaturn
.To do
unsafe
versionof_list
is_full
Functions not added
pop_all
is not an option as it is very likely to be too much work.push_all
: would create a lot of starvation and overhead if another thread move the tail before this operation is finished.try_compare_and_pop
,try_compare_and_push
,set_exn
etc.. : for a future PR is a good use of these functions is found.