3 ms·
How do you propose to implement duplex IO? And what’s the example case? With threads the reading and writing can happen simultaneously. The synchronization is
by liontwist 2y ago
How do you propose to implement duplex IO? And what’s the example case?
With threads the reading and writing can happen simultaneously. The synchronization is only on whatever data you need to share.
Note that if reading and writing are dependent, then single thread actually makes sense because you can’t do one without the other.
Otherwise the pattern of logic you will execute for reading or writing is completely different, which is why threading is the perfect abstraction.
- samsquire 2y agoI implemented split IO with io_uring, epoll and eventfd and my own thread safe comm pattern You can write to an eventfd to wake up io_uring listening on an epoll instance.