TLIB documentation
 

tlThread.h File Reference


Detailed Description

Thread management wrappers for TLIB.

OS independant thread management routines for TLIB.

#include "tlVision.h"

Include dependency graph for tlThread.h:

This graph shows which files directly or indirectly include this file:

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)


Function Documentation

int tlThreadChangePriority ( tlThreadHandle *  handle,
int  priority 
)

Change thread priority.

Parameters:
handle pointer to the thread identifier
priority priority to give to the thread
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
This call has no effect under Linux because we cannot change thread (process) priorities if we are not the superuser.

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.

Parameters:
func pointer to the function to run in thread
handle [out] thread identifier
Returns:
0 on success, -1 otherwise.
See error management for details.

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().

Parameters:
returnCode return value of the exiting thread on success, -1 otherwise. See error management for details.

int tlThreadJoin ( tlThreadHandle *  handle,
int *  returnCode,
int  timeout 
)

Block until the thread exits.

Parameters:
handle pointer to the thread identifier
returnCode priority to give to the thread
timeout time limit before the function returns (msec)
Returns:
On success, the return value of the thread is stored in returnCode and the function returns 0 on success, -1 otherwise.
See error management for details..

int tlThreadKill ( tlThreadHandle *  handle  ) 

Kill the thread.

Parameters:
handle pointer to the thread identifier
Returns:
0 on success, -1 otherwise.
See error management for details.
Remarks:
Programmers should call tlThreadJoin() to be sure that the thread has exited cleanly (and that it has had a chance to free any resources that it was using).

void tlThreadSleep ( unsigned int  msec  ) 

Suspend execution for a period.

Parameters:
msec sleep period (msec)



TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.