Public Member Functions | Static Public Member Functions

nsAutoLock Class Reference

nsAutoLock Stack-based locking object for PRLock. More...

#include <nsAutoLock.h>

Inheritance diagram for nsAutoLock:
Collaboration diagram for nsAutoLock:

List of all members.

Public Member Functions

 nsAutoLock (PRLock *aLock)
 Constructor The constructor aquires the given lock.
 ~nsAutoLock (void)
void lock ()
 lock Client may call this to reaquire the given lock.
void unlock ()
 unlock Client may call this to release the given lock.

Static Public Member Functions

static PRLockNewLock (const char *name)
 NewLock Allocates a new PRLock for use with nsAutoLock.
static void DestroyLock (PRLock *lock)

Detailed Description

nsAutoLock Stack-based locking object for PRLock.


Constructor & Destructor Documentation

nsAutoLock::nsAutoLock ( PRLock aLock  )  [inline]

Constructor The constructor aquires the given lock.

The destructor releases the lock.

Parameters:
aLock A valid PRLock* returned from the NSPR's PR_NewLock() function.
nsAutoLock::~nsAutoLock ( void   )  [inline]

Member Function Documentation

static void nsAutoLock::DestroyLock ( PRLock lock  )  [static]
void nsAutoLock::lock (  )  [inline]

lock Client may call this to reaquire the given lock.

Take special note that attempting to aquire a locked lock will hang or crash.

static PRLock* nsAutoLock::NewLock ( const char *  name  )  [static]

NewLock Allocates a new PRLock for use with nsAutoLock.

name is not checked for uniqueness.

Parameters:
name A name which can reference this lock
lock A valid PRLock* that was created by nsAutoLock::NewLock()
Returns:
nsnull if failure A valid PRLock* if successful, which must be destroyed by nsAutoLock::DestroyLock()
void nsAutoLock::unlock (  )  [inline]

unlock Client may call this to release the given lock.

Take special note unlocking an unlocked lock has undefined results.


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