Boost logo

Boost :

From: Wyss, Felix (felixw_at_[hidden])
Date: 2002-02-11 12:15:07


> I'd love to simply use a pthread_mutex/CRITICAL_SECTION (a critical section
> is a 'foolproof spinlock', it spins for a while, then falls back to a mutex)
> but people were (are) concerned about their efficiency.

That is correct, but the Win32 CRITICAL_SECTION structure uses 24 bytes compared to 4 bytes for a simple atomic-exchange based spin-lock. As for efficiency: unless there is a lot of contention, I would expect two atomic exchanges to incur the same overhead as two atomic increment/decrement operations (as in the current implementation of counted_base).

Felix


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