summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h')
-rw-r--r--contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h b/contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h
new file mode 100644
index 0000000..762dc7c
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/thread/windows/SDL_sysmutex_c.h
@@ -0,0 +1,73 @@
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "SDL_internal.h"
22
23#include "../../core/windows/SDL_windows.h"
24
25typedef SDL_Mutex *(*pfnSDL_CreateMutex)(void);
26typedef void (*pfnSDL_LockMutex)(SDL_Mutex *);
27typedef bool (*pfnSDL_TryLockMutex)(SDL_Mutex *);
28typedef void (*pfnSDL_UnlockMutex)(SDL_Mutex *);
29typedef void (*pfnSDL_DestroyMutex)(SDL_Mutex *);
30
31typedef enum
32{
33 SDL_MUTEX_INVALID = 0,
34 SDL_MUTEX_SRW,
35 SDL_MUTEX_CS,
36} SDL_MutexType;
37
38typedef struct SDL_mutex_impl_t
39{
40 pfnSDL_CreateMutex Create;
41 pfnSDL_DestroyMutex Destroy;
42 pfnSDL_LockMutex Lock;
43 pfnSDL_TryLockMutex TryLock;
44 pfnSDL_UnlockMutex Unlock;
45 // Needed by SDL_Condition:
46 SDL_MutexType Type;
47} SDL_mutex_impl_t;
48
49extern SDL_mutex_impl_t SDL_mutex_impl_active;
50
51#ifndef SRWLOCK_INIT
52#define SRWLOCK_INIT \
53 { \
54 0 \
55 }
56typedef struct _SRWLOCK
57{
58 PVOID Ptr;
59} SRWLOCK, *PSRWLOCK;
60#endif
61
62typedef struct SDL_mutex_srw
63{
64 SRWLOCK srw;
65 // SRW Locks are not recursive, that has to be handled by SDL:
66 DWORD count;
67 DWORD owner;
68} SDL_mutex_srw;
69
70typedef struct SDL_mutex_cs
71{
72 CRITICAL_SECTION cs;
73} SDL_mutex_cs;