C++
C#
VB
JScript
All

# mutex

Copyright (C) 2005 IENT-RWTH Aachen

Protects shared data structures from concurrent modifications

Remarks

Prefer the use of a scoped_lock rather than explicitly calling the acquire and release methods.

Groups

Constructors
mutex | Builds an instance of the object
Multithreading Functions
acquire | Waits until a lock can be acquired
release | Releases the lock
try_acquire | Returns true if it can immediately acquire a lock, else returns false
Destructors
~mutex | Destroys the object

Example

    int var;
    typedef gmt::mutex mutex_type;
    mutex_type mut;

    inline set_var(int x)
    {
      mutex_type::scoped_lock lock(mut);
      var=x;
    };

See Also

spin_mutex, condition_mutex, scoped_lock