Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-20 07:09:15


Kevin Atkinson wrote:
> #ifdef FAST_MUTEX_INIT_DESTROY
> Mutex() : l_(MUTEX_INIT) {}
> #else
> Mutex() {pthread_mutex_init(&l_, 0);}
> ~Mutex() {pthread_mutex_destroy($l_);}
> #endif

What makes you think that statically initializing a mutex is faster? It only
defers the initialization until the first lock call occurs. Plus,
pthread_mutex_init gives you the option to test for errors, should you
decide to do so.


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