![]() |
ARX
1.2.0
The next-generation open source augmented reality toolkit.
|
#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <ARX/ARUtil/thread_sub.h>#include <pthread.h>Classes | |
| struct | _THREAD_HANDLE_T |
Functions | |
| int | threadStartWait (THREAD_HANDLE_T *flag) |
| Worker-side. | |
| int | threadEndSignal (THREAD_HANDLE_T *flag) |
| Worker-side. Notify anyone waiting that the worker has ended. | |
| int | threadGetID (THREAD_HANDLE_T *flag) |
| Worker-side. Get the 'ID' value passed to the thread's start routine. | |
| void * | threadGetArg (THREAD_HANDLE_T *flag) |
| Worker-side. Get the 'arg' value passed to the thread's start routine. | |
| THREAD_HANDLE_T * | threadInit (int ID, void *arg, void *(*start_routine)(THREAD_HANDLE_T *)) |
| Client-side, set up. | |
| int | threadFree (THREAD_HANDLE_T **flag) |
| Client-side, set up. Frees structures associated with the thread handle pointed to by the location pointed to by flag. Thread should already have terminated (i.e. threadWaitQuit() has returned). Location pointed to by flag is set to NULL. | |
| int | threadStartSignal (THREAD_HANDLE_T *flag) |
| Client-side, communication. Send the worker thread the "start processing" request. | |
| int | threadGetStatus (THREAD_HANDLE_T *flag) |
| Client-side, communication. Find out (without waiting) whether a worker has ended. 0 = not started or started but not yet ended, 1 = ended. | |
| int | threadGetBusyStatus (THREAD_HANDLE_T *flag) |
| Client-side, communication. Find out if a worker is currently busy. 0 = worker not started or worker ended, 1 = worker started but not yet ended. | |
| int | threadEndWait (THREAD_HANDLE_T *flag) |
| Client-side, communication. Wait for thread to end processing. | |
| int | threadWaitQuit (THREAD_HANDLE_T *flag) |
| Client-side, communication. Tell a thread waiting for the "start processing" request to quit (exit), and wait until this has happened. | |
| int | threadGetCPU (void) |
| Returns the number of online CPUs in the system. | |
| int threadEndSignal | ( | THREAD_HANDLE_T * | flag | ) |
Worker-side. Notify anyone waiting that the worker has ended.
| int threadEndWait | ( | THREAD_HANDLE_T * | flag | ) |
Client-side, communication. Wait for thread to end processing.
| int threadFree | ( | THREAD_HANDLE_T ** | flag | ) |
Client-side, set up. Frees structures associated with the thread handle pointed to by the location pointed to by flag. Thread should already have terminated (i.e. threadWaitQuit() has returned). Location pointed to by flag is set to NULL.
| void * threadGetArg | ( | THREAD_HANDLE_T * | flag | ) |
Worker-side. Get the 'arg' value passed to the thread's start routine.
| int threadGetBusyStatus | ( | THREAD_HANDLE_T * | flag | ) |
Client-side, communication. Find out if a worker is currently busy. 0 = worker not started or worker ended, 1 = worker started but not yet ended.
| int threadGetCPU | ( | void | ) |
Returns the number of online CPUs in the system.
| int threadGetID | ( | THREAD_HANDLE_T * | flag | ) |
Worker-side. Get the 'ID' value passed to the thread's start routine.
| int threadGetStatus | ( | THREAD_HANDLE_T * | flag | ) |
Client-side, communication. Find out (without waiting) whether a worker has ended. 0 = not started or started but not yet ended, 1 = ended.
| THREAD_HANDLE_T * threadInit | ( | int | ID, |
| void * | arg, | ||
| void * | start_routine (*)(THREAD_HANDLE_T *) ) |
Client-side, set up.
Create a new thread, and launch start_routine() on it. Returns NULL in case of failure.
Example client structure:
| int threadStartSignal | ( | THREAD_HANDLE_T * | flag | ) |
Client-side, communication. Send the worker thread the "start processing" request.
| int threadStartWait | ( | THREAD_HANDLE_T * | flag | ) |
Worker-side.
Wait for the "start processing" request. Returns 0 if worker should start, or -1 if worker should quit (exit).
Example worker structure:
| int threadWaitQuit | ( | THREAD_HANDLE_T * | flag | ) |
Client-side, communication. Tell a thread waiting for the "start processing" request to quit (exit), and wait until this has happened.
1.18.0