TThreadSafe< T > Class Template ReferenceThis template class is for thread-safeing common data types.
More...
#include <ThreadSafe.h>
Inheritance diagram for TThreadSafe< T >:
[legend]List of all members.
|
Public Member Functions |
| | TThreadSafe (DWORD to=INFINITE) |
| | Constructor.
|
|
virtual | ~TThreadSafe () |
| | Destructor.
|
| void | settimeout (DWORD to) |
| | Sets the timeout value.
|
| BOOL | acquire (DWORD timeout=MAXDWORD) |
| | Acquires access to the object.
|
|
void | release () |
| | Releases lock.
|
| BOOL | lock (DWORD timeout=MAXDWORD) |
| | Locks the mutex.
|
|
void | unlock () |
| | Calls ReleaseMutex() once for each call to lock().
|
|
BOOL | islocked () |
| | Returns non zero if lock is acquired.
|
Detailed Description
template<class T>
class TThreadSafe< T >
This template class is for thread-safeing common data types.
Provides thread-safeing for common data types
Constructor & Destructor Documentation
|
|
Constructor.
- Parameters:
-
| [in] | to | - Lock timeout value |
|
Member Function Documentation
|
template<class T> |
| BOOL TThreadSafe< T >::acquire |
( |
DWORD |
timeout = MAXDWORD |
) |
[inline] |
|
|
|
Acquires access to the object.
- Parameters:
-
| [in] | timeout | - Maximum time in milli-seconds to wait for lock. |
Calling these directly does not keep track of how many times the mutex has been locked. Therefore release() must be called once for every call to aquire(). Failing to do so will deadlock other waiting threads
- Returns:
- Non-zero if lock is acquired
- See also:
|
|
template<class T> |
| BOOL TThreadSafe< T >::lock |
( |
DWORD |
timeout = MAXDWORD |
) |
[inline] |
|
|
|
Locks the mutex.
- Parameters:
-
| [in] | timeout | - Maximum time in milli-seconds to wait for lock. |
- Returns:
- Non-zero if lock is acquired
- See also:
|
|
template<class T> |
| void TThreadSafe< T >::settimeout |
( |
DWORD |
to |
) |
[inline] |
|
|
|
Sets the timeout value.
- Parameters:
-
|
The documentation for this class was generated from the following file:
|