The code above uses the WaitForSingleObject function with a time-out value of INFINITE, this causes the WaitForSingleObject function to wait for long until the operation is completed and this can make the thread appear to be "hung" when the write operation is simply taking a long time to complete or flow control has blocked the transmission.
boss your program is quite fascinating but i need a simple thing which is HOW A THREAD CAN READ A SERIAL PORT AND HOW A THREAD CAN WRITE A SERIAL PORT
please be specific because i only want to use threads in my application not even process or anything else.