Newton Dynamics  4.00
ndSyncMutex Class Reference

Generic counting mutex for synchronization of thread jobs. More...

Inheritance diagram for ndSyncMutex:
ndThreadPool ndScene ndThreadBackgroundWorker ndWorldScene ndWorldSceneCuda

Public Member Functions

D_CORE_API ndSyncMutex ()
 Create and initialize counter to zero.
 
D_CORE_API ~ndSyncMutex ()
 Destroy mutex.
 
D_CORE_API void Sync ()
 Synchronize with another worker threads. More...
 
D_CORE_API void Tick ()
 Increment internal variable m_count by one.
 
D_CORE_API void Release ()
 Decrement internal variable m_count by one and signal the thread to wakeup.
 

Detailed Description

Generic counting mutex for synchronization of thread jobs.

Member Function Documentation

◆ Sync()

void ndSyncMutex::Sync ( )

Synchronize with another worker threads.

When internal variable m_counter larger than zero, this function blocks the calling thread until another thread call member function Release.

When counter is zero, this function return immediately.