![]() |
Classes | |
struct | mrpt::system::TThreadHandle |
This structure contains the information needed to interface the threads API on each platform: More... | |
Namespaces | |
mrpt::system::detail | |
Auxiliary classes used internally to MRPT. | |
Enumerations | |
enum | mrpt::system::TProcessPriority { mrpt::system::ppIdle = 0, mrpt::system::ppNormal, mrpt::system::ppHigh, mrpt::system::ppVeryHigh } |
The type for cross-platform process (application) priorities. More... | |
enum | mrpt::system::TThreadPriority { mrpt::system::tpLowests =-15, mrpt::system::tpLower = -2, mrpt::system::tpLow = -1, mrpt::system::tpNormal = 0, mrpt::system::tpHigh = 1, mrpt::system::tpHigher = 2, mrpt::system::tpHighest = 15 } |
The type for cross-platform thread priorities. More... | |
Functions | |
template<typename T > | |
TThreadHandle | mrpt::system::createThread (void(*func)(T), T param) |
Creates a new thread from a function (or static method) with one generic parameter. More... | |
template<typename T > | |
TThreadHandle | mrpt::system::createThreadRef (void(*func)(T &), T ¶m) |
TThreadHandle | mrpt::system::createThread (void(*func)(void)) |
template<typename CLASS , typename PARAM > | |
TThreadHandle | mrpt::system::createThreadFromObjectMethod (CLASS *obj, void(CLASS::*func)(PARAM), PARAM param) |
Creates a new thread running a non-static method (so it will have access to "this") from another method of the same class - with one generic parameter. More... | |
template<typename CLASS , typename PARAM > | |
TThreadHandle | mrpt::system::createThreadFromObjectMethodRef (CLASS *obj, void(CLASS::*func)(PARAM), PARAM ¶m) |
template<typename CLASS > | |
TThreadHandle | mrpt::system::createThreadFromObjectMethod (CLASS *obj, void(CLASS::*func)(void)) |
void BASE_IMPEXP | mrpt::system::joinThread (const TThreadHandle &threadHandle) |
Waits until the given thread ends. More... | |
unsigned long BASE_IMPEXP | mrpt::system::getCurrentThreadId () MRPT_NO_THROWS |
Returns the ID of the current thread. More... | |
TThreadHandle BASE_IMPEXP | mrpt::system::getCurrentThreadHandle () MRPT_NO_THROWS |
Returns a handle to the current thread. More... | |
void BASE_IMPEXP | mrpt::system::exitThread () MRPT_NO_THROWS |
Explicit close of the current (running) thread. More... | |
void BASE_IMPEXP | mrpt::system::getCurrentThreadTimes (time_t &creationTime, time_t &exitTime, double &cpuTime) |
Returns the creation and exit times of the current thread and its CPU time consumed. More... | |
void BASE_IMPEXP | mrpt::system::changeThreadPriority (const TThreadHandle &threadHandle, TThreadPriority priority) |
Change the priority of the given thread. More... | |
void BASE_IMPEXP | mrpt::system::terminateThread (TThreadHandle &threadHandle) MRPT_NO_THROWS |
Terminate a thread, giving it no choice to delete objects, etc (use only as a last resource) More... | |
void BASE_IMPEXP | mrpt::system::changeCurrentProcessPriority (TProcessPriority priority) |
Change the priority of the given process (it applies to all the threads, plus independent modifiers for each thread). More... | |
unsigned int BASE_IMPEXP | mrpt::system::getNumberOfProcessors () |
Return the number of processors ("cores"), or 1 if it cannot be determined. More... | |
void BASE_IMPEXP | mrpt::system::sleep (int time_ms) MRPT_NO_THROWS |
An OS-independent method for sending the current thread to "sleep" for a given period of time. More... | |
bool BASE_IMPEXP | mrpt::system::launchProcess (const std::string &command) |
Executes the given command (which may contain a program + arguments), and waits until it finishes. More... | |
The type for cross-platform process (application) priorities.
Enumerator | |
---|---|
ppIdle | |
ppNormal | |
ppHigh | |
ppVeryHigh |
The type for cross-platform thread priorities.
Enumerator | |
---|---|
tpLowests | |
tpLower | |
tpLow | |
tpNormal | |
tpHigh | |
tpHigher | |
tpHighest |
void BASE_IMPEXP mrpt::system::changeCurrentProcessPriority | ( | TProcessPriority | priority | ) |
Change the priority of the given process (it applies to all the threads, plus independent modifiers for each thread).
void BASE_IMPEXP mrpt::system::changeThreadPriority | ( | const TThreadHandle & | threadHandle, |
TThreadPriority | priority | ||
) |
Change the priority of the given thread.
|
inline |
Creates a new thread from a function (or static method) with one generic parameter.
This function creates, and start, a new thread running some code given by a function. The thread function should end by returning as normal.
func | The function with the code to run in the thread. |
param | The parameter to be passed to the new thread function. |
std::exception | If the operation fails |
Definition at line 207 of file threads.h.
References mrpt::system::detail::ThreadCreateFunctor< T >::createThread().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 215 of file threads.h.
References mrpt::system::detail::ThreadCreateFunctorNoParams::createThread().
|
inline |
Creates a new thread running a non-static method (so it will have access to "this") from another method of the same class - with one generic parameter.
This function creates, and start, a new thread running some code given by a function. The thread function should end by returning as normal. Example of usage:
func | The function with the code to run in the thread. |
param | The parameter to be passed to the new thread function. |
std::exception | If the operation fails |
Definition at line 242 of file threads.h.
References mrpt::system::detail::ThreadCreateObjectFunctor< CLASS, PARAM >::createThread().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 252 of file threads.h.
References mrpt::system::detail::ThreadCreateObjectFunctorNoParams< CLASS >::createThread().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 247 of file threads.h.
References mrpt::system::detail::ThreadCreateObjectFunctor< CLASS, PARAM >::createThread().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 211 of file threads.h.
References mrpt::system::detail::ThreadCreateFunctor< T >::createThread().
void BASE_IMPEXP mrpt::system::exitThread | ( | ) |
Explicit close of the current (running) thread.
Do not use normally, it's better just to return from the running thread function.
TThreadHandle BASE_IMPEXP mrpt::system::getCurrentThreadHandle | ( | ) |
Returns a handle to the current thread.
unsigned long BASE_IMPEXP mrpt::system::getCurrentThreadId | ( | ) |
Returns the ID of the current thread.
void BASE_IMPEXP mrpt::system::getCurrentThreadTimes | ( | time_t & | creationTime, |
time_t & | exitTime, | ||
double & | cpuTime | ||
) |
Returns the creation and exit times of the current thread and its CPU time consumed.
creationTime | The creation time of the thread. |
exitTime | The exit time of the thread, or undefined if it is still running. |
cpuTime | The CPU time consumed by the thread, in seconds. |
std::exception | If the operation fails |
unsigned int BASE_IMPEXP mrpt::system::getNumberOfProcessors | ( | ) |
Return the number of processors ("cores"), or 1 if it cannot be determined.
void BASE_IMPEXP mrpt::system::joinThread | ( | const TThreadHandle & | threadHandle | ) |
Waits until the given thread ends.
bool BASE_IMPEXP mrpt::system::launchProcess | ( | const std::string & | command | ) |
Executes the given command (which may contain a program + arguments), and waits until it finishes.
void BASE_IMPEXP mrpt::system::sleep | ( | int | time_ms | ) |
An OS-independent method for sending the current thread to "sleep" for a given period of time.
time_ms | The sleep period, in miliseconds. |
void BASE_IMPEXP mrpt::system::terminateThread | ( | TThreadHandle & | threadHandle | ) |
Terminate a thread, giving it no choice to delete objects, etc (use only as a last resource)
Page generated by Doxygen 1.8.14 for MRPT 1.0.2 SVN: at lun oct 28 00:52:41 CET 2019 | Hosted on: |