AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
#include <thread.h>
Public Member Functions | |
AJAThread () | |
virtual | ~AJAThread () |
virtual AJAStatus | Start () |
virtual AJAStatus | Stop (uint32_t timeout=0xffffffff) |
virtual AJAStatus | Kill (uint32_t exitCode) |
virtual bool | Active () |
virtual bool | IsCurrentThread () |
virtual AJAStatus | SetPriority (AJAThreadPriority priority) |
virtual AJAStatus | GetPriority (AJAThreadPriority *pPriority) |
virtual AJAStatus | SetRealTime (AJAThreadRealTimePolicy policy, int priority) |
virtual AJAStatus | ThreadRun () |
virtual AJAStatus | ThreadInit () |
virtual bool | ThreadLoop () |
virtual AJAStatus | ThreadFlush () |
virtual bool | Terminate () |
virtual AJAStatus | Attach (AJAThreadFunction *pThreadFunction, void *pUserContext) |
virtual AJAStatus | SetThreadName (const char *name) |
Static Public Member Functions | |
static uint64_t | GetThreadId () |
Related Functions | |
(Note that these are not member functions.) | |
typedef void | AJAThreadFunction(AJAThread *pThread, void *pContext) |
System independent class for creating and controlling threads.
This class can be used 2 ways. If an external thread function is attached, the Start() method creates a thread and invokes the attached function. It is up to the attached function to query the Terminate() method to determine when the a Stop() has been issued. If no external thread function is attached, the Start() method creates a thread and invokes the ThreadRun() method. ThreadRun() calls ThreadInit() and then calls ThreadLoop() continuously until a Stop is issued at which time if calls ThreadFlush(). A subclass can override any of the functions it requires but should at least override ThreadLoop() to do some work then wait an appropriate amount of time.
AJAThread::AJAThread | ( | ) |
Definition at line 22 of file thread.cpp.
|
virtual |
Definition at line 28 of file thread.cpp.
|
virtual |
Is the thread active.
Definition at line 116 of file thread.cpp.
|
virtual |
Attach an external thread function.
The external function is called when the thread starts and returns when Terminate() is true or the task is complete.
[in] | pThreadFunction | External thread entry point |
[in] | pUserContext | Context passed to external thread function. return AJA_STATUS_SUCCESS External function attached |
Definition at line 169 of file thread.cpp.
|
virtual |
Get the thread priority.
Definition at line 142 of file thread.cpp.
|
static |
Get the Thread Id of the current running thread
Definition at line 180 of file thread.cpp.
|
virtual |
Is this the current running thread.
Definition at line 124 of file thread.cpp.
|
virtual |
Kill the thread.
Definition at line 108 of file thread.cpp.
|
virtual |
Set the thread priority.
[in] | priority | New thread priority. |
Definition at line 133 of file thread.cpp.
|
virtual |
Set the thread to be realtime.
[in] | AJAThreadRealTimePolicy | Thread policy int Realtime priority |
Definition at line 151 of file thread.cpp.
|
virtual |
Sets the thread name
NOTE: This call must be made from within the thread.
[in] | name | Name to assign to the thread |
Definition at line 176 of file thread.cpp.
|
virtual |
Start the thread.
Definition at line 91 of file thread.cpp.
|
virtual |
Stop the thread.
[in] | timeout | Wait timeout in milliseconds (0xffffffff infinite). |
Definition at line 100 of file thread.cpp.
|
virtual |
The thread must terminate.
Threads call this function to determine when to stop.
Definition at line 160 of file thread.cpp.
|
virtual |
Flush the thread resources.
Override this function to cleanup before the thread exits.
Definition at line 81 of file thread.cpp.
|
virtual |
Initialize the thread resources.
Override this function to initialize thread resources before executing the inner loop.
Definition at line 63 of file thread.cpp.
|
virtual |
The thread inner loop.
Override this function to repeat a task while the thread is active.
Definition at line 71 of file thread.cpp.
|
virtual |
Controlling function for the new thread.
This function calls ThreadInit() once then continuously call ThreadLoop until Terminate() is true or ThreadLoop() returns false. ThreadFlush() is called last. Override this function for complete control of the thread.
Definition at line 38 of file thread.cpp.
|
related |