5 ms·
Channel with an additional thread for sleep? Waiting for a channel is not a poll.
by vc8f6vVV 3y ago
Channel with an additional thread for sleep? Waiting for a channel is not a poll.
- conradludgate 3y agoYou either wait on the channel or wait on a read. How do you manage both?
- vc8f6vVV 3y agoYou wait on a shared channel so both read and sleep threads queue a message when ready (whichever comes first). Not sure about channels, but in other languages it would be a concurrent queue.
- conradludgate 3y agoThis won't cancel the read, it'll just ignore the result
- vc8f6vVV 3y agoMost languages I know allow killing a thread, or at least unblock a system call.