SDL Library Documentation
Prev |  | Next

# Chapter 12. Multi-threaded Programming

SDL provides functions for creating threads, mutexes, semphores and condition variables.

In general, you must be very aware of concurrency and data integrity issues when writing multi-threaded programs. Some good guidelines include:

- Don't call SDL video/event functions from separate threads

- Don't use any library functions in separate threads

- Don't perform any memory management in separate threads

- Lock global variables which may be accessed by multiple threads

- Never terminate threads, always set a flag and wait for them to quit

- Think very carefully about all possible ways your code may interact

> Note: SDL's threading is not implemented on MacOS, due to that lack of preemptive thread support (MacOS X dos nt suffer from this problem)

Prev | Home | Next
SDL_CDtrack | Up | SDL_CreateThread