Video | Events | Audio | CD-ROM | Threads |
In general, you must be very aware of concurrency and data integrity issues
when writing multi-threaded programs. Some good guidelines include:
Without any further ado:
Defined in
Defined in
Wait for a thread to finish (timeouts are not supported).
Defined in
Note: Under Win32 I know of no way to asynchronously signal a thread --
you must use other forms of cooperative IPC for communication between threads.
Defined in
Returns a new mutex, initially unlocked, or
Defined in
Locks a mutex, returning
extern SDL_Thread *SDL_CreateThread(void (*fn)(void *), void *data);
SDL_thread.h
SDL_CreateThread()
creates a new thread of execution that shares
all of its parent's global memory, signal handlers, file descriptors, etc,
and runs the function 'fn
' passed the void pointer
'data
'. The thread quits when this function returns.
extern void SDL_WaitThread(SDL_Thread *thread);
SDL_thread.h
extern void SDL_KillThread(SDL_Thread *thread);
SDL_thread.h
SDL_KillThread()
gracelessly terminates the thread associated
with 'thread
'. If possible, you should use some other
form of IPC to signal the thread to quit.
extern SDL_mutex *SDL_CreateMutex(void);
SDL_mutex.h
NULL
on error.
extern int SDL_mutexP(SDL_mutex *mutex);
SDL_mutex.h
0
, or -1
on error.