Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-09-02 12:35:40


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk