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

Figure out how to use polling systems outside of WSTP and IO #3685

Open
armanbilge opened this issue Jun 13, 2023 · 0 comments
Open

Figure out how to use polling systems outside of WSTP and IO #3685

armanbilge opened this issue Jun 13, 2023 · 0 comments

Comments

@armanbilge
Copy link
Member

Currently the only place you can materialize a PollingSystem is the work-stealing threadpool. Furthermore, all of our polling interfaces are currently in terms of IO and to get a hold of one you need an IORuntime.

Why do we care? Even if we are in IO on the WSTP, it might have the wrong kind of polling system installed, so we need some kind of fallback. Additionally, FS2 has promised Network and friends for any Async effect so we need to consider how to keep supporting that without having to maintain a handful of separate implementations that effectively do the same thing ...

I think these problems are somewhat orthogonal, but I suspect they are best solved jointly. Specifically we need:

  1. a way to materialize a polling system on a "selector thread"—some sort of single-threaded event loop that just does I/O polling.

  2. a way to use our polling interfaces from a non-IO effect

Controversial idea: for (1) just make a WSTP with one thread. For (2) keep using IO and use a Dispatcher to implement LiftIO[F] for arbitrary Async[F], similar to what Doobie does. This would work, and is arguably no different than using an NIO2 / Netty selector thread with CompletableFuture / ChannelFuture. Same deal: someone else's event loop with someone else's coroutine.

Follow-up to:

@armanbilge armanbilge added this to the v3.6.0 milestone Jun 13, 2023
@armanbilge armanbilge removed this from the v3.6.0 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant