cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

Add `ownPoller`

Open armanbilge opened this issue 1 year ago • 0 comments
trafficstars

This PR introduces a mechanism for checking if a given poller is "owned" by the current thread and thus is safe to interact with. This is useful primarily for cancelation, which may be requested from any thread, but can happy-path additional cleanup operations when on the owning thread.

The existing accessPoller and new ownPoller methods are now bundled up in a PollerProvider API.

Finally, SelectorSystem is improved to use ownPoller to attempt to remove the linked list node for a canceled selection operation, instead of simply clearing it.

Closes https://github.com/typelevel/cats-effect/issues/4009.

armanbilge avatar Sep 10 '24 01:09 armanbilge