Jetson Inference
DNN Vision Library
|
Thread class for launching an asynchronous operating-system dependent thread. More...
#include <Thread.h>
Public Member Functions | |
Thread () | |
Default constructor. More... | |
virtual | ~Thread () |
Destructor. More... | |
virtual void | Run () |
User-implemented thread main() function. More... | |
bool | Start () |
Start the thread. More... | |
bool | Start (ThreadEntryFunction entry, void *user_param=NULL) |
Start the thread, utilizing an entry function pointer provided by the user. More... | |
void | Stop (bool wait=false) |
Signal for the thread to stop running. More... | |
int | GetPriorityLevel () |
Get this thread's priority level. More... | |
bool | SetPriorityLevel (int priority) |
Set this thread's priority level. More... | |
pthread_t * | GetThreadID () |
Get thread identififer. More... | |
bool | LockAffinity (unsigned int cpu) |
Lock this thread to a CPU core. More... | |
Static Public Member Functions | |
static void | InitRealtime () |
Prime the system for realtime use. More... | |
static int | GetMaxPriority () |
Get the maximum priority level available. More... | |
static int | GetMinPriority () |
Get the minimum priority level avaiable. More... | |
static int | GetPriority (pthread_t *thread=NULL) |
Get the priority level of the thread. More... | |
static int | SetPriority (int priority, pthread_t *thread=NULL) |
Set the priority level of the thread. More... | |
static void | Yield (unsigned int ms) |
Whatever thread you are calling from, yield the processor for the specified number of milliseconds. More... | |
static bool | SetAffinity (unsigned int cpu, pthread_t *thread=NULL) |
Lock the specified thread's affinity to a CPU core. More... | |
static int | GetCPU () |
Look up which CPU core the thread is running on. More... | |
Static Protected Member Functions | |
static void * | DefaultEntry (void *param) |
Protected Attributes | |
pthread_t | mThreadID |
bool | mThreadStarted |
Thread class for launching an asynchronous operating-system dependent thread.
To make your own thread, provide a function pointer of the thread's entry point, or inherit from this class and implement your own Run() function.
Thread::Thread | ( | ) |
Default constructor.
|
virtual |
Destructor.
Automatically stops the thread.
|
staticprotected |
|
static |
Look up which CPU core the thread is running on.
|
static |
Get the maximum priority level available.
|
static |
Get the minimum priority level avaiable.
|
static |
Get the priority level of the thread.
thread | The thread, or if NULL, the currently running thread. |
int Thread::GetPriorityLevel | ( | ) |
Get this thread's priority level.
|
inline |
Get thread identififer.
|
static |
Prime the system for realtime use.
Mostly this is locking a large group of pages into memory.
bool Thread::LockAffinity | ( | unsigned int | cpu | ) |
Lock this thread to a CPU core.
|
virtual |
User-implemented thread main() function.
|
static |
Lock the specified thread's affinity to a CPU core.
cpu | The CPU core to lock the thread to. |
thread | The thread, or if NULL, the currently running thread. |
|
static |
Set the priority level of the thread.
thread | The thread, or if NULL, the currently running thread. |
bool Thread::SetPriorityLevel | ( | int | priority | ) |
Set this thread's priority level.
bool Thread::Start | ( | ) |
Start the thread.
This will asynchronously call the Run() function.
bool Thread::Start | ( | ThreadEntryFunction | entry, |
void * | user_param = NULL |
||
) |
Start the thread, utilizing an entry function pointer provided by the user.
void Thread::Stop | ( | bool | wait = false | ) |
Signal for the thread to stop running.
If wait is true, Stop() will block until the thread has exited.
|
static |
Whatever thread you are calling from, yield the processor for the specified number of milliseconds.
Accuracy may vary wildly the lower you go, and depending on the platform.
|
protected |
|
protected |