Skip to content

Commit 2be749b

Browse files
committed
include: More category documentation.
Reference Issue #11847.
1 parent 642262e commit 2be749b

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

include/SDL3/SDL_mutex.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@
2525
/**
2626
* # CategoryMutex
2727
*
28-
* Functions to provide thread synchronization primitives.
28+
* SDL offers several thread synchronization primitives. This document can't
29+
* cover the complicated topic of thread safety, but reading up on what each
30+
* of these primitives are, why they are useful, and how to correctly use them
31+
* is vital to writing correct and safe multithreaded programs.
32+
*
33+
* - Mutexes: SDL_CreateMutex()
34+
* - Read/Write locks: SDL_CreateRWLock()
35+
* - Semaphores: SDL_CreateSemaphore()
36+
* - Condition variables: SDL_CreateCondition()
37+
*
38+
* SDL also offers a datatype, SDL_InitState, which can be used to make sure
39+
* only one thread initializes/deinitializes some resource that several
40+
* threads might try to use for the first time simultaneously.
2941
*/
3042

3143
#include <SDL3/SDL_stdinc.h>

include/SDL3/SDL_thread.h

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@
2525
/**
2626
* # CategoryThread
2727
*
28-
* SDL thread management routines.
28+
* SDL offers cross-platform thread management functions. These are mostly
29+
* concerned with starting threads, setting their priority, and dealing with
30+
* their termination.
31+
*
32+
* In addition, there is support for Thread Local Storage (data that is unique
33+
* to each thread, but accessed from a single key).
34+
*
35+
* On platforms without thread support (such as Emscripten when built without
36+
* pthreads), these functions still exist, but things like SDL_CreateThread()
37+
* will report failure without doing anything.
38+
*
39+
* If you're going to work with threads, you almost certainly need to have a
40+
* good understanding of [CategoryMutex](CategoryMutex) as well.
2941
*/
3042

3143
#include <SDL3/SDL_stdinc.h>

0 commit comments

Comments
 (0)