| Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
MutexLock< num_doors > Class Template Reference#include <MutexLock.h>
Inheritance diagram for MutexLock< num_doors >: ![]() Detailed Descriptiontemplate<unsigned int num_doors>
A software only mutual exclusion lock. (does not depend on processor or OS support).
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| MutexLock () | |
| constructor, just calls the init() function. | |
| void | lock (int id) |
| blocks (by busy looping on do_try_lock()) until a lock is achieved | |
| bool | try_lock (int id) |
| attempts to get a lock, returns true if it succeeds | |
| void | unlock () |
| releases one recursive lock-level from whoever has the current lock | |
| void | releaseAll () |
| completely unlocks, regardless of how many times a recursive lock has been obtained | |
| unsigned int | get_lock_level () const |
| returns the lockcount | |
| int | owner () |
| returns the current owner's id | |
| void | forget (int id) |
| allows you to reset one of the possible owners, so another process can take its place. This is not tested | |
Protected Member Functions | |
| bool | do_try_lock (unsigned int index, bool block) |
| Does the work of trying to get a lock. | |
| unsigned int | lookup (int id) |
| returns the internal index mapping to the id number supplied by the process | |
| void | init () |
| Doesn't do anything if you have the MUTEX_LOCK_ET_USE_SPINCOUNT undef'ed. Used to do a memset, but that was causing problems.... | |
| void | spin () |
| If you find a way to sleep for a few microseconds instead of busy waiting, put it here. | |
Protected Attributes | |
| door_t | doors [num_doors] |
| holds all the doors | |
| unsigned int | doors_used |
| counts the number of doors used | |
| unsigned int | owner_index |
| holds the door index of the current lock owner | |
| unsigned int | lockcount |
| the depth of the lock, 0 when unlocked | |
Classes | |
| struct | door_t |
| Holds per process shared info, one of these per process. More... | |
|
|||||||||
|
constructor, just calls the init() function.
Definition at line 269 of file MutexLock.h. |
|
||||||||||||||||
|
Does the work of trying to get a lock.
Pass Definition at line 400 of file MutexLock.h. Referenced by MutexLock< num_doors >::forget(), MutexLock< num_doors >::lock(), and MutexLock< num_doors >::try_lock(). |
|
||||||||||
|
allows you to reset one of the possible owners, so another process can take its place. This is not tested
Definition at line 479 of file MutexLock.h. |
|
|||||||||
|
returns the lockcount
Definition at line 289 of file MutexLock.h. |
|
|||||||||
|
Doesn't do anything if you have the MUTEX_LOCK_ET_USE_SPINCOUNT undef'ed. Used to do a memset, but that was causing problems....
Definition at line 321 of file MutexLock.h. Referenced by MutexLock< MAX_ACCESS >::MutexLock(). |
|
||||||||||
|
blocks (by busy looping on do_try_lock()) until a lock is achieved You should pass some process-specific ID number as the input - just make sure no other process will be using the same value.
Definition at line 351 of file MutexLock.h. Referenced by MotionManager::func_begin(), MotionManager::InitAccess(), MotionManager::lock(), and SharedQueue< maxsize, maxentries >::reserve(). |
|
||||||||||
|
returns the internal index mapping to the id number supplied by the process
Definition at line 460 of file MutexLock.h. Referenced by MutexLock< num_doors >::forget(), MutexLock< num_doors >::lock(), and MutexLock< num_doors >::try_lock(). |
|
|||||||||
|
returns the current owner's id
Definition at line 292 of file MutexLock.h. Referenced by MutexLock< num_doors >::lock(), and MutexLock< num_doors >::try_lock(). |
|
|||||||||
|
completely unlocks, regardless of how many times a recursive lock has been obtained
Definition at line 286 of file MutexLock.h. |
|
|||||||||
|
If you find a way to sleep for a few microseconds instead of busy waiting, put it here.
Definition at line 323 of file MutexLock.h. Referenced by MutexLock< num_doors >::do_try_lock(). |
|
||||||||||
|
attempts to get a lock, returns true if it succeeds You should pass some process-specific ID number as the input - just make sure no other process will be using the same value. Definition at line 363 of file MutexLock.h. Referenced by MotionManager::trylock(). |
|
|||||||||
|
releases one recursive lock-level from whoever has the current lock
Definition at line 379 of file MutexLock.h. Referenced by MotionManager::func_end(), MotionManager::InitAccess(), MutexLock< MAX_ACCESS >::releaseAll(), and MotionManager::unlock(). |
|
|||||
|
holds all the doors
Definition at line 342 of file MutexLock.h. Referenced by MutexLock< num_doors >::do_try_lock(), MutexLock< num_doors >::forget(), MutexLock< num_doors >::lookup(), MutexLock< MAX_ACCESS >::owner(), and MutexLock< num_doors >::unlock(). |
|
|||||
|
counts the number of doors used
Definition at line 343 of file MutexLock.h. Referenced by MutexLock< num_doors >::forget(), and MutexLock< num_doors >::lookup(). |
|
|||||
|
the depth of the lock, 0 when unlocked
Definition at line 345 of file MutexLock.h. Referenced by MutexLock< MAX_ACCESS >::get_lock_level(), MutexLock< num_doors >::lock(), MutexLock< MAX_ACCESS >::releaseAll(), MutexLock< num_doors >::try_lock(), and MutexLock< num_doors >::unlock(). |
|
|||||
|
holds the door index of the current lock owner
Definition at line 344 of file MutexLock.h. Referenced by MutexLock< num_doors >::do_try_lock(), MutexLock< MAX_ACCESS >::owner(), and MutexLock< num_doors >::unlock(). |
|
Tekkotsu v2.4 |
Generated Wed Aug 10 11:06:52 2005 by Doxygen 1.4.4 |