talostrading / sonic

Sonic is a Go library for network and I/O programming that provides developers with a consistent asynchronous model, with a focus on achieving the lowest possible latency and jitter in Go.
MIT License
676 stars 16 forks source link

Support multishot reads/writes #119

Open sergiu128 opened 6 months ago

sergiu128 commented 6 months ago

After each read/write, the poller de-registers the read/write notification event from its watchlist (explicitly for epoll, implicitly for kqueue as there we use oneshot registrations). That means a subsequent read/write needs to be registered again. Some applications want to read/write in a loop (i.e. read in the OnRead callback, analog for writes). In that case, we can save some time by not de-registering the read/write on a poll. The caller will then have to explicitly cancel the read/write.