I have a number of threads (100\'s) that each execute for a few seconds at a time. When they are executing, they spend a significant amount of that time waiting for a response
I cannot speak for AsyncFree's capabilities, but in general COM port programming in Windows supports Overlapped I/O, so you can efficiently wait for a notification when data arrives by using the WaitCommEvent()
function with one of the WaitFor...()
family of functions, such as WaitForSingleObject()
. The thread can be put into a sleep state until the notify is issues, at which time it "wakes up" to read from the port until there is nothing further to read, then it can go back to sleep until the next notify.