TracktionEngine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
engine::ScopedThreadExitStatusEnabler Struct Reference

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 ()
 Cleans up the exit status.
 
std::thread::id getID () const
 Returns the thread_id.
 

Detailed Description

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

std::thread t ([]
{
for (;;)
{
break;
// Some work...
}
});
t.join();
bool shouldCurrentThreadExit()
Returns true if the current thread is waiting to exit.
void signalThreadShouldExit(std::thread::id)
Can be used to signal that the current thread is waiting to exit.
Enables the calling thread to be cancelled from another thread and the calling thread to be able to q...
Definition tracktion_engine/utilities/tracktion_Threads.h:45

Constructor & Destructor Documentation

◆ ScopedThreadExitStatusEnabler()

engine::ScopedThreadExitStatusEnabler::ScopedThreadExitStatusEnabler ( )

Enables the current thread to query shouldCurrentThreadExit and other threads to call signalThreadShouldExit.

◆ ~ScopedThreadExitStatusEnabler()

engine::ScopedThreadExitStatusEnabler::~ScopedThreadExitStatusEnabler ( )

Cleans up the exit status.

Member Function Documentation

◆ getID()

std::thread::id engine::ScopedThreadExitStatusEnabler::getID ( ) const

Returns the thread_id.


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