Boost logo

Boost Users :

From: Russell Hind (yg-boost-users_at_[hidden])
Date: 2003-05-12 03:07:54


Peter G wrote:
> agghhh it clicked... when i lock a mutex, all i am doing is preventing
> another thread from executing the code that follows until the mutex is
> unlocked.. regardless of what that code does...
>

I think your on the right lines. When you lock a mutex, you are
preventing any other thread from acquiring a lock on the same mutex
until the thread that has locked it successfully, releases that lock.

The thread attempting to lock an already locked mutex will block until
the mutex is unlocked. Unless you use another type of mutex (e.g.
try_mutex or timed_mutex)

Cheers

Russell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net