class MSpinLock

Jump to documentation

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

public members:

MSpinLock ()
~MSpinLock ()
void lock ()
void unlock ()
bool tryLock ()

Documentation

Methods for managing spin locks on threads created with MThreadPool and MThreadAsync. (OpenMaya)
Description

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

Functions

MSpinLock:: MSpinLock ()
Description

Create new spin lock object. The object is created unlocked.

MSpinLock:: ~MSpinLock ()

Description

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.

void MSpinLock:: lock ()

Description

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.

void MSpinLock:: unlock ()

Description

Release the current lock.

bool MSpinLock:: tryLock ()

Description

Description

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

Return Value

  • true lock was obtained
  • false lock was not obtained

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright