smol-rs / polling

Portable interface to epoll, kqueue, event ports, and wepoll
Apache License 2.0
534 stars 65 forks source link

Only one thread can be waiting for I/O events at a time #167

Closed miaomiao1992 closed 8 months ago

miaomiao1992 commented 10 months ago

if i let main thread wait for accept events,and i let other threads wait for read events just like main-sub reactor,what will happen?

notgull commented 9 months ago

If another thread attempts to wait() on the Poller, it will immediately return Ok(0). This is because platforms have inconsistent behavior for waiting on multiple threads.

notgull commented 9 months ago

See also: https://github.com/smol-rs/polling/issues/69