Boost logo

Boost :

From: Scott (cheesy4poofs_at_[hidden])
Date: 2007-10-25 13:53:38


I'm writing an application that runs on both Win32 (vs 2005) and Linux
(gcc). I was curious what the performance penalty is for a scenario like
this:

Foo1()
{
        recursive_mutex::scoped_lock lock(mutex); // acquire initial mutex
lock
        Foo2();
        ...
}

Foo2()
{
        recursive_mutex::scoped_lock lock(mutex); // increment lock count
        ...
}

Relatively speaking, how much time does it cost to
1) Locking the mutex initially and increment the lock count
Vs
2) Determine that a mutex is already locked by the thread and just increment
the lock count?

I'm also curious how much faster mutex is over recursive_mutex for both
platforms. If anybody has done performance profiling or just knows in
general the different mutex scenario performance costs, I'd greatly
appreciate any info. :)

Thanks very much,
Scott


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