-
Notifications
You must be signed in to change notification settings - Fork 531
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
Add API to polling system to attempt to get current poller without shifting #4009
Comments
Just because I'm being dumb… Why do we need this again? |
The scenario we are concerned with here is not related to |
I'm definitely confused then. If you're not on the WSTP, then any fast-path to get the current poller would fail, so you'd end up with |
Nope. The OP is exactly like the timers situation: suppose you are trying to cancel a timer. That doesn't mean that you need to get onto the WSTP so that you can safely access a timer heap. All you want to do is see if you have access to a heap on your current thread, and if so, if it is the one you want to manipulate. You don't want access to any heap, you want access to a very specific one if possible, otherwise you can use a fallback mechanism. Same deal here. You want access to a very specific poller, not any poller, and if you can't immediately get that access, you want to fallback, not get rescheduled. Currently there is no API that supports this for pollers. For timers there is. |
How would you envision identifying the poller? Like, you know you want a specific poller, but how would you communicate that to the API? |
Reference equality? Here's how we do it for timers. cats-effect/core/jvm/src/main/scala/cats/effect/unsafe/WorkerThread.scala Lines 294 to 295 in 769a89e
|
This would mostly be to support cancelation with a similar mechanism used in the new timer heap introduced in #3781. Specifically, using this API you can check if your current thread owns the poller you need to send the cancel to. If so, it can be done on a fast/simple happy-path, otherwise it will need to go through some concurrent-safe mechanism.
The text was updated successfully, but these errors were encountered: