Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

int phMutex::lock  ) 

Acquire the mutex. (blocking) phMutex is a recursive mutex. The number of times this method is called should also correspond with the number of times the phMutex::unlock() method is called.

The recursive feature allows nested locking of the mutex. Nested locking allows the ability to lock "this" at the begining of every method paired with releasing the mutex before returning from any inheriting object's method in which the mutex was successfully acquired. If the mutex wasn't successfully acquired in a method, it shouldn't be unlocked in that method. Unlocking in one scope when the mutex wasn't successfully acquired in that scope could cause the scoped locking to be mismatched and releasing of the mutex earlier than expected.

The success of the method.
Return values:
phSUCCESS The thread locked the mutex object.
phFAIL The thread failed to execute the method. This can be for a couple reasons:
  • the thread couldn't acquire the mutex at all
  • the object is invalid/unallocated/uninitialized on the heap or stack
  • the object is allocated statically on the stack and the stack was over run because the system doesn't have a large enough stack size.

Definition at line 358 of file phMutex.cpp.

Copyright (C) 2002 - 2007 Philip D.S. Thoren ( )
University Of Massachusetts at Lowell
Robotics Lab Logo

Generated on Sat Jun 16 02:45:00 2007 for phission by  doxygen 1.4.4