Public Member Functions | Data Fields

ProxyMutex Class Reference

Lock object used in continuations and threads. More...

#include <I_Lock.h>

Inherits RefCountObj.

Collaboration diagram for ProxyMutex:
Collaboration graph
[legend]

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

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
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().


Field Documentation

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().


The documentation for this class was generated from the following file: