![]() |
C-chat
|
An OS-agnostic API to manipulate threads. More...
Go to the source code of this file.
Classes | |
struct | Thread |
Represents a thread. More... | |
Macros | |
#define | THREAD_ENTRY_POINT THREAD_RETURN_TYPE THREAD_CALL_TYPE |
A macro to declare a function meant to be used as an entry point for a thread. | |
Typedefs | |
typedef THREAD_RETURN_TYPE(THREAD_CALL_TYPE * | FP_THREAD) (void *) |
typedef FP_THREAD | THREAD_FUNCTION_POINTER |
The type for a valid thread entry point. | |
typedef struct Thread | Thread |
Functions | |
Thread | createThread (THREAD_FUNCTION_POINTER entryPoint, void *data) |
Creates and starts a thread. More... | |
void | destroyThread (Thread *thread) |
Destroys the given thread. More... | |
void | joinThread (Thread *thread) |
Waits for the given thread to finish. More... | |
An OS-agnostic API to manipulate threads.
Thread createThread | ( | THREAD_FUNCTION_POINTER | entryPoint, |
void * | data | ||
) |
Creates and starts a thread.
Creates a thread which the entry point will be the given function. The given entry point MUST be declared as a thread entry point. Example :
THREAD_ENTRY_POINT entryPointName(void* data) { return EXIT_SUCCESS; }
entryPoint | The entry point for the thread |
data | A pointer to be passed to thread's entry point |
void destroyThread | ( | Thread * | thread | ) |
Destroys the given thread.
thread | A pointer to the thread to destroy |
void joinThread | ( | Thread * | thread | ) |
Waits for the given thread to finish.
thread | A pointer to the thread to wait |