|
TracktionEngine
|
Enables the calling thread to be cancelled from another thread and the calling thread to be able to query this. More...
#include <tracktion_Threads.h>
Public Member Functions | |
| ScopedThreadExitStatusEnabler () | |
| Enables the current thread to query shouldCurrentThreadExit and other threads to call signalThreadShouldExit. | |
| ScopedThreadExitStatusEnabler (std::thread::id) | |
| As above, but registers the given thread rather than the calling one. | |
| ~ScopedThreadExitStatusEnabler () | |
| Cleans up the exit status. | |
| std::thread::id | getID () const |
| Returns the thread_id. | |
Enables the calling thread to be cancelled from another thread and the calling thread to be able to query this.
Put one of these in your thread body then you can use signalThreadShouldExit and shouldCurrentThreadExit
| engine::ScopedThreadExitStatusEnabler::ScopedThreadExitStatusEnabler | ( | ) |
Enables the current thread to query shouldCurrentThreadExit and other threads to call signalThreadShouldExit.
|
explicit |
As above, but registers the given thread rather than the calling one.
Use this from a controlling thread straight after creating the thread, so the registration exists for the thread's whole lifetime by construction: it can then be signalled at any point up to the join with no possibility of the registration not having appeared yet or having already gone. Destroy this after joining the thread.
| engine::ScopedThreadExitStatusEnabler::~ScopedThreadExitStatusEnabler | ( | ) |
Cleans up the exit status.
| std::thread::id engine::ScopedThreadExitStatusEnabler::getID | ( | ) | const |
Returns the thread_id.