HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_TaskLockT< NESTED > Class Template Reference

#include <UT_TaskLock.h>

+ Inheritance diagram for UT_TaskLockT< NESTED >:

Public Types

using Scope = UT_UniqueLock< UT_TaskLockT< NESTED >>
 Class for auto-unlocking. More...
 

Public Member Functions

 UT_TaskLockT ()
 
 ~UT_TaskLockT ()
 
int numWaitingThreads () const
 
void lock ()
 
void lock (bool &was_first)
 
bool timedLock (int timeout)
 
bool tryLock ()
 
bool safeLock ()
 
void unlock ()
 
bool hasLock ()
 

Friends

class Scope
 

Detailed Description

template<bool NESTED>
class UT_TaskLockT< NESTED >

A recursive mutex class for synchronizing amongst tasks defined by UT_TaskScope.

The assumptions that UT_TaskScope uses for tasks are:

  • Tasks are hierarchical in a forest of trees
  • When child tasks are running, the parent task is not
  • Child tasks always finish before their parent task

Requirements:

  • You must unlock before your own task ends
  • You must unlock your lock before waiting for a child task to end

Definition at line 49 of file UT_TaskLock.h.

Member Typedef Documentation

template<bool NESTED>
using UT_TaskLockT< NESTED >::Scope = UT_UniqueLock<UT_TaskLockT<NESTED>>

Class for auto-unlocking.

Definition at line 272 of file UT_TaskLock.h.

Constructor & Destructor Documentation

template<bool NESTED>
UT_TaskLockT< NESTED >::UT_TaskLockT ( )
inline

Definition at line 212 of file UT_TaskLock.h.

template<bool NESTED>
UT_TaskLockT< NESTED >::~UT_TaskLockT ( )
inline

Definition at line 216 of file UT_TaskLock.h.

Member Function Documentation

template<bool NESTED>
bool UT_TaskLockT< NESTED >::hasLock ( )
inline

Definition at line 266 of file UT_TaskLock.h.

template<bool NESTED>
void UT_TaskLockT< NESTED >::lock ( )
inline

Definition at line 227 of file UT_TaskLock.h.

template<bool NESTED>
void UT_TaskLockT< NESTED >::lock ( bool &  was_first)
inline

Same as lock() except it also returns if it was the first time this task scope obtained the lock (ie. non-recursively).

Definition at line 236 of file UT_TaskLock.h.

template<bool NESTED>
int UT_TaskLockT< NESTED >::numWaitingThreads ( ) const
inline

Definition at line 222 of file UT_TaskLock.h.

template<bool NESTED>
bool UT_TaskLockT< NESTED >::safeLock ( )
inline

Definition at line 255 of file UT_TaskLock.h.

template<bool NESTED>
bool UT_TaskLockT< NESTED >::timedLock ( int  timeout)
inline

Definition at line 242 of file UT_TaskLock.h.

template<bool NESTED>
bool UT_TaskLockT< NESTED >::tryLock ( )
inline

Definition at line 250 of file UT_TaskLock.h.

template<bool NESTED>
void UT_TaskLockT< NESTED >::unlock ( )
inline

Definition at line 261 of file UT_TaskLock.h.

Friends And Related Function Documentation

template<bool NESTED>
friend class Scope
friend

Definition at line 52 of file UT_TaskLock.h.


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