Base Module  VST 3.6.5
SDK for developing VST Plug-in
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes
FThread Class Reference

FThread wraps threads for each platform. More...

#include <fthread.h>

Public Member Functions

 FThread (const char8 *name="FThread")
 Thread constructor. More...
 
virtual ~FThread ()
 Destructor. More...
 
void run ()
 Starts the thread. More...
 
void terminate ()
 Terminates the thread. More...
 
bool isRunning ()
 Checks if thread is (still) running. More...
 
bool waitDead (int32 timeOut)
 Waits for thread dead. More...
 
virtual bool setPriority (int32 priority)
 Sets thread priority. More...
 
int32 getPriority ()
 Gets the current priority of this thread. More...
 
virtual void cleanup ()
 Override this method for any cleanup code. More...
 
virtual uint32 entry ()
 Override this method for the thread loop. More...
 
const StringgetName () const
 Gets the name of this thread. More...
 
void * getThreadReference () const
 Gets the reference of this thread. More...
 
bool setCpuAffinity (int32 cpu)
 Sets cpu affinity. More...
 
bool isInThreadContext () const
 Check if current execution is in the thread context. More...
 

Static Public Member Functions

static void setSpy (IThreadSpy *spy)
 Sets a thread spy which gets informed about new or removed threads. More...
 

Protected Attributes

int32 priority
 Priority of thread. More...
 
int32 cpu
 Cpu used by this thread. More...
 
bool running
 Running state. More...
 

Static Protected Attributes

static IThreadSpygSpy
 Global thread spy. More...
 

Detailed Description

FThread wraps threads for each platform.

termination is best with waitDead and flags in the run loop....

Constructor & Destructor Documentation

FThread ( const char8 *  name = "FThread")

Thread constructor.

Parameters
namethe name of the thread (can be seen in debugger)
~FThread ( )
virtual

Destructor.

Member Function Documentation

void run ( )

Starts the thread.

void terminate ( )

Terminates the thread.

bool isRunning ( )
inline

Checks if thread is (still) running.

Returns
true if running
bool waitDead ( int32  timeOut)

Waits for thread dead.

This is the best to terminate this thread.

Parameters
timeOuttimeout in ms
Returns
true if not timed out
bool setPriority ( int32  prio)
virtual

Sets thread priority.

To boost priority a little bit permit a temporary raised task priority ....

Permit temporary raise of task priority.

Parameters
prioritythread priority, see FThreadPriority
Returns
true if successful

taskPriority defaults to static taskPriority if not set

int32 getPriority ( )
inline

Gets the current priority of this thread.

Returns
priority, see FThreadPriority
void cleanup ( )
virtual

Override this method for any cleanup code.

uint32 entry ( )
virtual

Override this method for the thread loop.

Returns
thread return value.
const String& getName ( ) const
inline

Gets the name of this thread.

Returns
thread name
void * getThreadReference ( ) const

Gets the reference of this thread.

Returns
thread reference
bool setCpuAffinity ( int32  cpu)

Sets cpu affinity.

Binds thread to a specific cpu.

Parameters
cpucpu id
Returns
true if successful
bool isInThreadContext ( ) const

Check if current execution is in the thread context.

Returns
true if successful
static void setSpy ( IThreadSpy spy)
static

Sets a thread spy which gets informed about new or removed threads.

There is only one spy allowed and it works without reference couting.

Parameters
spya thread spy

Field Documentation

int32 priority
protected

Priority of thread.

int32 cpu
protected

Cpu used by this thread.

bool running
protected

Running state.

IThreadSpy* gSpy
staticprotected

Global thread spy.

Empty

Copyright ©2015 Steinberg Media Technologies GmbH. All Rights Reserved.