Use MainLoop to implement Communication::ReadThread() instead of
blocking reads. Most importantly, this makes it possible to use
the newly implemented TriggerPendingCallbacks() mechanism to immediately
interrupt waiting for new data. This in turn will make it possible to
enable the possibility of writing to the descriptor using the same
thread.
Sponsored by: The FreeBSD Foundation
Have you considered putting this code (some version of it) inside InterruptRead? Basically replacing the select call inside BytesAvailable with something MainLoop-based ?