- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# MSpinLock Class Reference
OpenMaya - API module for common classes

This reference page is linked to from the following overview topics: スレッド化と Maya, API クラスとプラグイン, サンプル C++ プラグインの説明.

Search for all occurrences

## Detailed Description

Methods for managing spin locks on threads created with MThreadPool and MThreadAsync.

Lightweight spin-lock class to be used with threads created by MThreadPool and MThreadAsync.

Examples:

  threadTestWithLocksCmd.cpp.

`#include <MSpinLock.h>`

List of all members.

## Public Member Functions
| MSpinLock ()
| Create new spin lock object.
| ~MSpinLock ()
| Destructor.
void | lock ()
| Create a lock.
void | unlock ()
| Release the current lock.
bool | tryLock ()
| Attempt to lock the object. Search for all occurrences

## Constructor & Destructor Documentation

MSpinLock | ( |  | ) |

Create new spin lock object.

The object is created unlocked.

~MSpinLock | ( |  | ) |

Destructor.

Calling the desctructor on a locked spin lock object does not unlock the object. That must be done by calling unlock() before calling the destructor.

## Member Function Documentation

void lock | ( |  | ) |

Search for all occurrences

Create a lock.

If the object 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.

Examples:
  threadTestWithLocksCmd.cpp.

bool tryLock | ( |  | ) |

Search for all occurrences

Attempt to lock the object.

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

Returns:
  - true lock was obtained
  - false lock was not obtained

MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock
MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock MSpinLock