Regina Calculation Engine
Classes | Public Member Functions | List of all members
regina::NMutex Class Reference

Deprecated class that provides mutexes for use with multithreaded code. More...

#include <utilities/nthread.h>

Classes

class  MutexLock
 A utility class for locking and unlocking a mutex. More...
 

Public Member Functions

 NMutex ()
 Creates a new mutex. More...
 
 ~NMutex ()
 Destroys this mutex. More...
 

Detailed Description

Deprecated class that provides mutexes for use with multithreaded code.

This class is designed to work in conjunction with the old NThread class, which is also deprecated. New code should use the C++11 std::thread, std::mutex and related classes instead.

This class provides a mutual exclusion device (mutex), used to ensure that different threads do not interfere when working with the same data.

A mutex can be either locked or unlocked, and can only be locked by one thread at a time. If a second thread tries to lock the mutex, it will be suspended until the mutex is unlocked by the original locking thread.

A mutex is locked by declaring a local variable of type NMutex::MutexLock. See the NMutex::MutexLock class notes for details.

Python:
Not present.
Deprecated:
NThread and NMutex are deprecated; new code should use the C++11 std::thread, std::mutex and std::lock_guard classes instead.

Constructor & Destructor Documentation

§ NMutex()

regina::NMutex::NMutex ( )
inline

Creates a new mutex.

The mutex will be created unlocked.

§ ~NMutex()

regina::NMutex::~NMutex ( )
inline

Destroys this mutex.

Precondition
This mutex is unlocked.

The documentation for this class was generated from the following file:

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).