-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Document that take
uses spinning
#20
Comments
Other options include:
|
Another option is that we could consider adding a proper backoff here. We would still be spinning, but could have the thread sleep while spinning rather than just emitting This might be a good compromise between not burning CPU in a tight spin loop and having to allocate a mutex/condvar pair for every slot. |
This commit updates the API docs for `Slab::take` to note explicitly that the calling thread is blocked by spinning until outstanding references to the removed slot are dropped. The docs now warn against using `take` if references to a slot may last for a long time, and note that it should only be used when such references are relatively short-lived. Fixes #20 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit updates the API docs for `Slab::take` to note explicitly that the calling thread is blocked by spinning until outstanding references to the removed slot are dropped. The docs now warn against using `take` if references to a slot may last for a long time, and note that it should only be used when such references are relatively short-lived. Fixes #20 Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Spinning has different performance/energy characteristics than mutexes/condition vars, and it would be good to document that this is what
take
does.The text was updated successfully, but these errors were encountered: