Base class for for all multi thread functionality. More...
Public Member Functions | |
| D_CORE_API | ndThread () |
| Empty default constructor after creation all threads go to a wait state. | |
| virtual D_CORE_API | ~ndThread () |
| Empty, does not terminate the thread loop. More... | |
| D_CORE_API void | SetName (const char *const name) |
| Set thread name. More... | |
| D_CORE_API void | Signal () |
| Set the thread, to execute one call to and go back to a wait state | |
| D_CORE_API void | Finish () |
| Force the thread loop to terminate. More... | |
| virtual void | ThreadFunction ()=0 |
| Thread function to execute in a perpetual loop until the thread is terminated. More... | |
Public Member Functions inherited from ndClassAlloc | |
| ndClassAlloc () | |
| Empty default constructor. | |
| ~ndClassAlloc () | |
| Empty. | |
Public Member Functions inherited from ndSemaphore | |
| D_CORE_API | ndSemaphore () |
| Create and initialize counter to zero. | |
| D_CORE_API | ~ndSemaphore () |
| Destroy semaphore. | |
| D_CORE_API ndInt32 | GetCount () const |
| Returns counter counter value. | |
| D_CORE_API bool | Wait () |
| Synchronize with another threads. More... | |
| D_CORE_API void | Signal () |
| Notify a thread blocked by member function Wait to wake and test m_counter again. More... | |
| D_CORE_API void | Terminate () |
| Notify a waiting thread on member function Wait that is time to exit the thread loop. | |
Public Member Functions inherited from ndAtomic< bool > | |
| ndAtomic (bool val) | |
| ndAtomic (const ndAtomic< bool > ©) | |
| bool | operator= (bool value) |
Protected Member Functions | |
| virtual void | Release () |
Additional Inherited Members | |
Static Public Member Functions inherited from ndClassAlloc | |
| D_OPERATOR_NEW_AND_DELETE static D_CORE_API void * | Malloc (size_t size) |
| Generic allocation for any function subclass from ndClassAlloc. | |
| static D_CORE_API void | Free (void *const ptr) |
| Generic destruction for any function subclass from ndClassAlloc. | |
Public Attributes inherited from ndThreadName | |
| char | m_name [32] |
Base class for for all multi thread functionality.
|
virtual |
Empty, does not terminate the thread loop.
The thread loop is only terminated after calling Finish.
| void ndThread::Finish | ( | ) |
Force the thread loop to terminate.
This function must be call explicitly when the application wants to terminate the thread because the destructor does not do it.
| void ndThread::SetName | ( | const char *const | name | ) |
Set thread name.
Useful for when debugging or profiler and application.
|
pure virtual |
Thread function to execute in a perpetual loop until the thread is terminated.
Each time the thread owner calls function Signal, the loop execute one call to this function and upon return, the thread goes back to wait for another signal
or to exit the loop.
Implemented in ndWorldScene.