#include <mutex.h>
Inheritance diagram for mutex_base:


Public Member Functions | |
| mutex_base () | |
| Constructs a new mutex. | |
| virtual | ~mutex_base () |
| Destroys the mutex. It should not be locked upon destruction. | |
| void | construct () |
| Constructor for use with malloc/free instead of new/delete. | |
| void | destruct () |
| Destructor for use with malloc/free instead of new/delete. | |
| void | lock () |
| Clamps down on the mutex, if possible. | |
| void | unlock () |
| Gives up the possession of the mutex. | |
| virtual void | establish_lock () |
| Satisfies base class requirements for locking. | |
| virtual void | repeal_lock () |
| Satisfies base class requirements for unlocking. | |
| void | defang () |
| Removes the underlying OS synchronization primitive. | |
The word "mutex" is an abbreviation for "mutual exclusion". The mutex provides a simple synchronization object that supports the programming of critical sections. It is guaranteed to be safe for threads, but it is only useful within one application rather than between multiple applications. The mutex_base is hardly ever used directly; instead the mutex class should be used.
Definition at line 31 of file mutex.h.
| mutex_base::mutex_base | ( | ) |
| mutex_base::~mutex_base | ( | ) | [virtual] |
Destroys the mutex. It should not be locked upon destruction.
Definition at line 33 of file mutex.cpp.
References destruct().
| void mutex_base::construct | ( | ) |
Constructor for use with malloc/free instead of new/delete.
Definition at line 39 of file mutex.cpp.
Referenced by mutex_base().
| void mutex_base::destruct | ( | ) |
Destructor for use with malloc/free instead of new/delete.
Definition at line 59 of file mutex.cpp.
References defang().
Referenced by ~mutex_base().
| void mutex_base::lock | ( | ) |
Clamps down on the mutex, if possible.
Otherwise the current thread is blocked until the mutex is unlocked.
Definition at line 79 of file mutex.cpp.
Referenced by reader_writer_lock::begin_read(), reader_writer_lock::begin_write(), safe_roller::current(), safe_callback::end_availability(), reader_writer_lock::end_read(), establish_lock(), octopus::evaluate(), key_repository::lock(), runtime_history::lock(), buffer_manager::lock_buffer(), file_transfer_tentacle::lock_directory(), locked_object< log_base >::lock_object(), socket_minder::lock_socket_data(), octopus::lock_tentacle(), octopus::lock_tentacles(), life_maintainer::locking_find(), safe_roller::next_id(), octopus::remove_tentacle(), safe_roller::set_current(), semaphore::signal(), test_recursive_locking(), semaphore::wait(), life_maintainer::zap(), and timer_driver::~timer_driver().
| void mutex_base::unlock | ( | ) |
Gives up the possession of the mutex.
Definition at line 91 of file mutex.cpp.
Referenced by reader_writer_lock::begin_read(), safe_roller::current(), safe_callback::end_availability(), reader_writer_lock::end_read(), reader_writer_lock::end_write(), octopus::evaluate(), key_repository::lock(), buffer_manager::lock_buffer(), file_transfer_tentacle::lock_directory(), socket_minder::lock_socket_data(), octopus::lock_tentacle(), life_maintainer::locking_find(), safe_roller::next_id(), octopus::remove_tentacle(), repeal_lock(), safe_roller::set_current(), semaphore::signal(), test_recursive_locking(), key_repository::unlock(), runtime_history::unlock(), buffer_manager::unlock_buffer(), file_transfer_tentacle::unlock_directory(), life_maintainer::unlock_find(), socket_minder::unlock_socket_data(), octopus::unlock_tentacle(), octopus::unlock_tentacles(), semaphore::wait(), life_maintainer::zap(), and timer_driver::~timer_driver().
| void mutex_base::establish_lock | ( | ) | [virtual] |
Satisfies base class requirements for locking.
Implements synchronizer_base.
Definition at line 35 of file mutex.cpp.
References lock().
| void mutex_base::repeal_lock | ( | ) | [virtual] |
Satisfies base class requirements for unlocking.
Implements synchronizer_base.
Definition at line 37 of file mutex.cpp.
References unlock().
| void mutex_base::defang | ( | ) |
Removes the underlying OS synchronization primitive.
This method renders this mutex object inoperable. This is useful when the reason for the lock has vanished, but the mutex object cannot be deleted yet. Sometimes it may still be referred to, but there is no longer any critical section to be protected.
Definition at line 64 of file mutex.cpp.
Referenced by destruct().
1.5.1