Incorrect use of the Ctrl+C event can lead to busy-waiting in socket and serial port IO.
Fixed missing includes in low-level IO functions. Changed implementation of condition variables to use kernel event objects, in order to preserve compatibility with NT 5.1.
The symbol __Windows__ is defined when building a native (non-Cygwin) binary.