docs/html/classThread.html
| | Jetson Inference
DNN Vision Library |
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Thread Class Reference Utilities Library (jetson-utils) » Multithreading
Thread class for launching an asynchronous operating-system dependent thread. More...
#include <Thread.h>
|
|
| | 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 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 void * | DefaultEntry (void *param) | | |
|
| | 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 Thread::~Thread | ( | | ) | |
| virtual |
Destructor.
Automatically stops the thread.
|
| static void* Thread::DefaultEntry | ( | void * | param | ) | |
| staticprotected |
|
| static int Thread::GetCPU | ( | | ) | |
| static |
Look up which CPU core the thread is running on.
|
| static int Thread::GetMaxPriority | ( | | ) | |
| static |
Get the maximum priority level available.
|
| static int Thread::GetMinPriority | ( | | ) | |
| static |
Get the minimum priority level avaiable.
|
| static int Thread::GetPriority | ( | pthread_t * | thread = NULL | ) | |
| static |
Get the priority level of the thread.
Parameters
| thread | The thread, or if NULL, the currently running thread. |
| int Thread::GetPriorityLevel | ( | | ) | |
Get this thread's priority level.
|
| pthread_t* Thread::GetThreadID | ( | | ) | |
| inline |
Get thread identififer.
|
| static void Thread::InitRealtime | ( | | ) | |
| 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 void Thread::Run | ( | | ) | |
| virtual |
User-implemented thread main() function.
|
| static bool Thread::SetAffinity | ( | unsigned int | cpu, |
| | | pthread_t * | thread = NULL |
| | ) | | |
| static |
Lock the specified thread's affinity to a CPU core.
Parameters
| cpu | The CPU core to lock the thread to. | | thread | The thread, or if NULL, the currently running thread. |
|
| static int Thread::SetPriority | ( | int | priority, |
| | | pthread_t * | thread = NULL |
| | ) | | |
| static |
Set the priority level of the thread.
Parameters
| 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.
ReturnsFalse if an error occurred and the thread could not be started.
| bool Thread::Start | ( | ThreadEntryFunction | entry, |
| | | void * | user_param = NULL |
| | ) | | |
Start the thread, utilizing an entry function pointer provided by the user.
ReturnsFalse if an error occurred and the thread could not be started.
| 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 void Thread::Yield | ( | unsigned int | ms | ) | |
| 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.
|
| pthread_t Thread::mThreadID |
| protected |
|
| bool Thread::mThreadStarted |
| protected |
The documentation for this class was generated from the following file: