OS independant thread management routines for TLIB.
#include "tlVision.h"
Go to the source code of this file.
Functions | |
int | tlThreadCreate (TLTHREAD_FUNC_PTR func, tlThreadHandle *handle) |
void | tlThreadExit (int returnCode) |
int | tlThreadKill (tlThreadHandle *handle) |
int | tlThreadChangePriority (tlThreadHandle *handle, int priority) |
int | tlThreadJoin (tlThreadHandle *handle, int *returnCode, int timeout) |
void | tlThreadSleep (unsigned int msec) |
int tlThreadChangePriority | ( | tlThreadHandle * | handle, | |
int | priority | |||
) |
Change thread priority.
handle | pointer to the thread identifier | |
priority | priority to give to the thread |
References TL_ERRNO_MSG, TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_THREAD, TL_NO_ERROR, and tlThreadChangePriority().
Referenced by tlThreadChangePriority().
int tlThreadCreate | ( | TLTHREAD_FUNC_PTR | func, | |
tlThreadHandle * | handle | |||
) |
Create a thread. On success, the identifier of the newly created thread is stored in handle and 0 is returned. On error, a non-zero error code is returned.
func | pointer to the function to run in thread | |
handle | [out] thread identifier |
References TL_ERRNO_MSG, TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_THREAD, and tlThreadCreate().
Referenced by tlThreadCreate().
void tlThreadExit | ( | int | returnCode | ) |
Exit the thread (from within the thread). The return value of the thread can be consulted from another thread using tlThreadJoin().
returnCode | return value of the exiting thread on success, -1 otherwise. See error management for details. |
References TL_ERRNO_MSG, TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_THREAD, and tlThreadExit().
Referenced by tlThreadExit().
int tlThreadJoin | ( | tlThreadHandle * | handle, | |
int * | returnCode, | |||
int | timeout | |||
) |
Block until the thread exits.
handle | pointer to the thread identifier | |
returnCode | priority to give to the thread | |
timeout | time limit before the function returns (msec) |
References TL_ERRNO_MSG, TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_THREAD, TL_ERROR_TIMEOUT, and tlThreadJoin().
Referenced by tlThreadJoin().
int tlThreadKill | ( | tlThreadHandle * | handle | ) |
Kill the thread.
handle | pointer to the thread identifier |
References TL_ERRNO_MSG, TL_ERROR_NOT_IMPLEMENTED, TL_ERROR_THREAD, and tlThreadKill().
Referenced by tlThreadKill().
void tlThreadSleep | ( | unsigned int | msec | ) |
Suspend execution for a period.
msec | sleep period (msec) |
References TL_ERROR_NOT_IMPLEMENTED, and tlThreadSleep().
Referenced by tlSourceFiles::grab(), and tlThreadSleep().