Lock object used in continuations and threads. More...
#include <I_Lock.h>
Inherits RefCountObj.
Public Member Functions | |
void | free () |
ProxyMutex () | |
Constructor - use new_ProxyMutex() instead. | |
void | init (const char *name="UnnamedMutex") |
Initializes the underlying mutex object. | |
Data Fields | |
ink_mutex | the_mutex |
Underlying mutex object. | |
volatile EThreadPtr | thread_holding |
Backpointer to owning thread. | |
int | nthread_holding |
Lock object used in continuations and threads.
The ProxyMutex class is the main synchronization object used throughout the Event System. It is a reference counted object that provides mutually exclusive access to a resource. Since the Event System is multithreaded by design, the ProxyMutex is required to protect data structures and state information that could otherwise be affected by the action of concurrent threads.
A ProxyMutex object has an ink_mutex member (defined in ink_mutex.h) which is a wrapper around the platform dependent mutex type. This member allows the ProxyMutex to provide the functionallity required by the users of the class without the burden of platform specific function calls.
The ProxyMutex also has a reference to the current EThread holding the lock as a back pointer for verifying that it is released correctly.
Acquiring/Releasing locks:
Included with the ProxyMutex class, there are several macros that allow you to lock/unlock the underlying mutex object.
Definition at line 67 of file I_Lock.h.
ProxyMutex::ProxyMutex | ( | ) | [inline] |
Constructor - use new_ProxyMutex() instead.
The constructor of a ProxyMutex object. Initializes the state of the object but leaves the initialization of the mutex member until it is needed (through init()). Do not use this constructor, the preferred mechanism for creating a ProxyMutex is via the new_ProxyMutex function, which provides a faster allocation.
Definition at line 119 of file I_Lock.h.
References nthread_holding, and thread_holding.
void ProxyMutex::free | ( | ) | [inline, virtual] |
Reimplemented from RefCountObj.
Definition at line 425 of file I_Lock.h.
References ink_mutex_destroy(), mutexAllocator, and the_mutex.
void ProxyMutex::init | ( | const char * | name = "UnnamedMutex" |
) | [inline] |
Initializes the underlying mutex object.
After constructing your ProxyMutex object, use this function to initialize the underlying mutex object with an optional name.
name | Name to identify this ProxyMutex. Its use depends on the given platform. |
Definition at line 152 of file I_Lock.h.
References ink_mutex_init(), and the_mutex.
Referenced by new_ProxyMutex().
Definition at line 89 of file I_Lock.h.
Referenced by Mutex_unlock(), ProxyMutex(), sdk_sanity_check_mutex(), Thread::Thread(), and TSMutexCheck().
Underlying mutex object.
The platform independent mutex for the ProxyMutex class. You must not modify or set it directly.
Definition at line 78 of file I_Lock.h.
Referenced by free(), init(), and Mutex_unlock().
volatile EThreadPtr ProxyMutex::thread_holding |
Backpointer to owning thread.
This is a pointer to the thread currently holding the mutex lock. You must not modify or set this value directly.
Definition at line 87 of file I_Lock.h.
Referenced by Log::access(), UnixNetProcessor::connect_re_internal(), dir_delete_lock(), dir_insert_lock(), dir_overwrite_lock(), HostDBContinuation::dnsEvent(), HostDBContinuation::dnsPendingEvent(), HostDBContinuation::do_dns(), HostDBContinuation::do_get_response(), Log::flush_thread_main(), free_CacheVC(), HostDBContinuation::insert(), LogObjectManager::log(), HostDBContinuation::lookup_done(), Mutex_unlock(), Cache::open_read(), CacheVC::openReadChooseWriter(), CacheVC::openReadClose(), CacheVC::openReadFromWriter(), CacheVC::openReadMain(), CacheVC::openReadReadDone(), CacheVC::openReadStartEarliest(), CacheVC::openReadStartHead(), LogFile::preproc_and_try_delete(), probe(), HostDBContinuation::probeEvent(), HttpSM::process_srv_info(), ProxyMutex(), rand_CacheKey(), MutexTryLock::release(), Log::va_error(), LogFile::write_ascii_logbuffer3(), and MutexTryLock::~MutexTryLock().