Help! about 2 threads share one com port
-
Now i have one serial com port, and i want it been shared by 2 threads. Now i am using the binary semaphore to control it. I want to ask is it good? or is it good to use the critical section? Can any body help me compare these method to let me see which one is better? Thanks
-
Now i have one serial com port, and i want it been shared by 2 threads. Now i am using the binary semaphore to control it. I want to ask is it good? or is it good to use the critical section? Can any body help me compare these method to let me see which one is better? Thanks
Microsoft's own documentation makes the claim that the critical section is faster. Critical section can be used for synchronization among many threads within the same process. The critical section can not synchronize separate threads from different processes. It is difficult to make reader/writer type objects with critical sections.