Not to mention that there's no standard name for "the serial port" (even on DOS), that doesn't appear to be a portable "open" call, and if the call to open the serial port fails you shouldn't even be making the rest of the calls no matter what thread you make it in.