
2 Sep
2005
2 Sep
'05
5:35 p.m.
Greer, Joe wrote:
-----Original Message----- Running the test program, the semaphore version gives a timing of 16s compiled with gcc-mingw-4.0.1, and 22s compiled with MSVC 7.1, on my machine. The mutex version gives timings of 23s (gcc) and 29s (MSVC), so the semaphore version is clearly faster.
Why use either? I wrote an implantation using critical sections and my timings are:
Semaphores: 20 Mutex: 27 Critical section: 0
I must be missing something vital.
You have a local static that is not thread-safe in general.