Tested on Mac OS, Linux and Windows with UART emulated on USB.
I wrote general BSD code, because it should work, but I am not able to test it.
On Mac OS I am quite sure that drain behaves as needed.
For Windows it seems that drain is actually part of Write, because Write was slow and Drain was fast. But I have not found any mention in Win32 docs about buffering and asynchronous write, so I kept it.
For Linux Drain is also taking more time than writing.
Tested on Mac OS, Linux and Windows with UART emulated on USB.
I wrote general BSD code, because it should work, but I am not able to test it.
On Mac OS I am quite sure that drain behaves as needed. For Windows it seems that drain is actually part of
Write
, becauseWrite
was slow andDrain
was fast. But I have not found any mention in Win32 docs about buffering and asynchronous write, so I kept it. For LinuxDrain
is also taking more time than writing.