Boost logo

Boost :

From: Greer, Joe (jgreer_at_[hidden])
Date: 2005-09-02 14:23:21


Yes, but it could have been a class static as easily and have the same
performance. In general, named mutexes, semaphores, and events in
windows are for ipc use and are therefore much more expensive to create
than the anonymous versions and critical sections are much quicker than
the handle base apis in low contention situations and as quick in high
contention ones. At least, that's what my tests have shown.

joe

> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Peter Dimov
> Sent: Friday, September 02, 2005 12:36 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [boost thread rework] New version uploaded to
> BoostVault
>
> 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.
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


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