C++ API Reference

Methods for managing locks on threads created. More...

#include <MMutexLock.h>

Public Member Functions

 MMutexLock ()
 Create new mutex object. More...
 
 ~MMutexLock ()
 Calling the destructor on a locked mutex does not unlock the mutex. More...
 
void lock ()
 Create a lock. More...
 
void unlock ()
 Release the current lock on a mutex.
 
bool tryLock ()
 Attempt to lock the mutex. More...
 

Detailed Description

Methods for managing locks on threads created.

Mutex lock class now just forwarding to std::mutex.

This method is obsolete. [as of Maya 2020]

Deprecated:
Use std::mutex directly

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MMutexLock ( )

Create new mutex object.

The object is created unlocked.

~MMutexLock ( )

Calling the destructor on a locked mutex does not unlock the mutex.

That must be done by calling unlock() before calling the destructor.

Member Function Documentation

void lock ( )

Create a lock.

If the mutex is available it is locked immediately. If it is already locked by another thread, this function waits until the other thread has unlocked it, then creates the lock.

bool tryLock ( )

Attempt to lock the mutex.

If the mutex is already locked by another thread, the function returns right away.

Returns
  • true lock was obtained
  • false lock was not obtained

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