VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
DtScopedSequenceLock Class Reference

A scoped sequence lock. More...

+ Inheritance diagram for DtScopedSequenceLock:
+ Collaboration diagram for DtScopedSequenceLock:

Public Types

typedef void(* LockFunction )(void *)
 Define Lock function.

Public Member Functions

 DtScopedSequenceLock (const DtScopedSequenceLock &orig)
 Public copy constructor, is called on return from the implementation/ This method creates the lock.
virtual ~DtScopedSequenceLock ()
 Destructor, unlocks the object.

Protected Member Functions

 DtScopedSequenceLock (void *object, LockFunction lockCB, LockFunction unlockCB)
 Protected constructor is called by private implementation of lock.

Protected Attributes

LockFunction myLockCallback
 The acquire lock callback.
LockFunction myUnlockCallback
 The release lock callback.
void * myObject
 The object to pass to the callbacks.

Detailed Description

A scoped sequence lock.

A scoped sequence lock, maintains a lock on an DtThreadSafe object until it goes out of scope. DtScopedSequenceLock is return by value from a DtThreadSafe object and should not be copied or maintained. A sequence lock is required when multiple operations are performed that need to be atomic.

A DtScopedSequenceLock requires several additional locks and thus is more expensive than normal ThreadSafe calls. However each additional call in a sequence may be slightly cheaper due to it already having the lock. It is faster to copy the DtThreadSafe to a local object and do the operations then reassign it, however this may not always be possible. The exception to this is if copying is overly expensive.

It is not possible to create a DtScopedSequenceLock as the implementation of its lock and unlock callbacks are defined by the DtThreadSafe object

DtThreadSafe<DtString> stringTS("Hello World");
{
DtScopedSequenceLock sequenceLock = stringTS.sequenceLock();
... all calls to stringTS in this scope will now be single threaded.
}

Member Typedef Documentation

typedef void(* DtScopedSequenceLock::LockFunction)(void *)

Define Lock function.

Constructor & Destructor Documentation

DtScopedSequenceLock::DtScopedSequenceLock ( const DtScopedSequenceLock orig)

Public copy constructor, is called on return from the implementation/ This method creates the lock.

virtual DtScopedSequenceLock::~DtScopedSequenceLock ( )
virtual

Destructor, unlocks the object.

DtScopedSequenceLock::DtScopedSequenceLock ( void *  object,
LockFunction  lockCB,
LockFunction  unlockCB 
)
protected

Protected constructor is called by private implementation of lock.

Member Data Documentation

LockFunction DtScopedSequenceLock::myLockCallback
protected

The acquire lock callback.

void* DtScopedSequenceLock::myObject
protected

The object to pass to the callbacks.

LockFunction DtScopedSequenceLock::myUnlockCallback
protected

The release lock callback.


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

Document ID: Generated on Mon Jun 22 21:18:40 EDT 2020 from SVN revision 213785
Copyright © 2005-2018 MAK Technologies. All Rights Reserved (www.mak.com)