Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2005-09-04 16:54:10


Alexander Terekhov <terekhov_at_[hidden]> writes:

> Anthony Williams wrote:
> [...]
>> once.hpp uses a Semaphore, whereas once_mutex.hpp uses a mutex, the same as
>> the existing boost::thread implementation.
>
> IIRC boost::thread implementation optimizes fast path (get rid of
> kernel calls) and only briefly holds the named lock.
>
> Your stuff looks different in this respect. Is this intentional?

No. Thanks for spotting it; optimizing the mutex implementation makes the
overall timings ~100 times faster in my tests. I have attached a simple
optimised implementation.

I am not sure if I can optimize the Semaphore method, since it relies on the
Semaphore itself storing the initialized/not flag. I guess that rules it out,
then.

Anthony

-- 
Anthony Williams
Software Developer



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