ucc::mutex Class Reference
Generic non-recursive exclusive lock class.
More...
#include <thread.h>
Data Structures |
class | gaurd |
| Gaurd class to apply scope based mutex locking to objects. More...
|
Public Member Functions |
| mutex () |
| Create a mutex lock.
|
| ~mutex () |
| Destroy mutex lock, release waiting threads.
|
void | acquire (void) |
| Acquire mutex lock.
|
void | lock (void) |
| Acquire mutex lock.
|
void | unlock (void) |
| Release acquired lock.
|
void | release (void) |
| Release acquired lock.
|
Static Public Member Functions |
static void | acquire (mutex &lock) |
| Convenience function to acquire a mutex lock.
|
static void | lock (mutex &lock) |
| Convenience function to acquire a mutex lock.
|
static void | unlock (mutex &lock) |
| Convenience function to release an aquired mutex lock.
|
static void | release (mutex &lock) |
| Convenience function to release an aquired mutex lock.
|
static void | acquire (pthread_mutex_t *lock) |
| Convenience function to acquire os native mutex lock directly.
|
static void | lock (pthread_mutex_t *lock) |
| Convenience function to acquire os native mutex lock directly.
|
static void | unlock (pthread_mutex_t *lock) |
| Convenience function to release os native mutex lock directly.
|
static void | release (pthread_mutex_t *lock) |
| Convenience function to release os native mutex lock directly.
|
static void | indexing (unsigned size) |
| Specify hash table size for gaurd protection.
|
static void | protect (void *pointer) |
| Specify pointer/object/resource to gaurd protect.
|
static void | release (void *pointer) |
| Specify a pointer/object/resource to release.
|
Detailed Description
Generic non-recursive exclusive lock class.
This class also impliments the exclusive_lock protocol. In addition, an interface is offered to support dynamically managed mutexes which are internally pooled. These can be used to protect and serialize arbitrary access to memory and objects on demand. This offers an advantage over embedding mutexes to serialize access to individual objects since the maximum number of mutexes will never be greater than the number of actually running threads rather than the number of objects being potentially protected. The ability to hash the pointer address into an indexed table further optimizes access by reducing the chance for collisions on the primary index mutex.
- Author:
- David Sugar <dyfet@gnutelephony.org>
Definition at line 1076 of file thread.h.
Member Function Documentation
static void ucc::mutex::acquire |
( |
pthread_mutex_t * |
lock |
) |
[inline, static] |
Convenience function to acquire os native mutex lock directly.
- Parameters:
-
Definition at line 1203 of file thread.h.
static void ucc::mutex::acquire |
( |
mutex & |
lock |
) |
[inline, static] |
Convenience function to acquire a mutex lock.
- Parameters:
-
Definition at line 1175 of file thread.h.
void ucc::mutex::acquire |
( |
void |
|
) |
[inline] |
Acquire mutex lock.
This is a blocking operation.
Definition at line 1150 of file thread.h.
static void ucc::mutex::indexing |
( |
unsigned |
size |
) |
[static] |
Specify hash table size for gaurd protection.
The default is 1. This should be called at initialization time from the main thread of the application before any other threads are created.
- Parameters:
-
| size | of hash table used for gaurding. |
static void ucc::mutex::lock |
( |
pthread_mutex_t * |
lock |
) |
[inline, static] |
Convenience function to acquire os native mutex lock directly.
- Parameters:
-
Definition at line 1210 of file thread.h.
static void ucc::mutex::lock |
( |
mutex & |
lock |
) |
[inline, static] |
Convenience function to acquire a mutex lock.
- Parameters:
-
Definition at line 1182 of file thread.h.
void ucc::mutex::lock |
( |
void |
|
) |
[inline] |
Acquire mutex lock.
This is a blocking operation.
Definition at line 1156 of file thread.h.
static void ucc::mutex::protect |
( |
void * |
pointer |
) |
[static] |
Specify pointer/object/resource to gaurd protect.
This uses a dynamically managed mutex.
- Parameters:
-
static void ucc::mutex::release |
( |
void * |
pointer |
) |
[static] |
Specify a pointer/object/resource to release.
- Parameters:
-
static void ucc::mutex::release |
( |
pthread_mutex_t * |
lock |
) |
[inline, static] |
Convenience function to release os native mutex lock directly.
- Parameters:
-
Definition at line 1224 of file thread.h.
static void ucc::mutex::release |
( |
mutex & |
lock |
) |
[inline, static] |
Convenience function to release an aquired mutex lock.
- Parameters:
-
Definition at line 1196 of file thread.h.
static void ucc::mutex::unlock |
( |
pthread_mutex_t * |
lock |
) |
[inline, static] |
Convenience function to release os native mutex lock directly.
- Parameters:
-
Definition at line 1217 of file thread.h.
static void ucc::mutex::unlock |
( |
mutex & |
lock |
) |
[inline, static] |
Convenience function to release an aquired mutex lock.
- Parameters:
-
Definition at line 1189 of file thread.h.
The documentation for this class was generated from the following file: