Path: blob/master/thirdparty/sdl/thread/windows/SDL_sysmutex_c.h
9905 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/20#include "SDL_internal.h"2122#include "../../core/windows/SDL_windows.h"2324typedef SDL_Mutex *(*pfnSDL_CreateMutex)(void);25typedef void (*pfnSDL_LockMutex)(SDL_Mutex *);26typedef bool (*pfnSDL_TryLockMutex)(SDL_Mutex *);27typedef void (*pfnSDL_UnlockMutex)(SDL_Mutex *);28typedef void (*pfnSDL_DestroyMutex)(SDL_Mutex *);2930typedef enum31{32SDL_MUTEX_INVALID = 0,33SDL_MUTEX_SRW,34SDL_MUTEX_CS,35} SDL_MutexType;3637typedef struct SDL_mutex_impl_t38{39pfnSDL_CreateMutex Create;40pfnSDL_DestroyMutex Destroy;41pfnSDL_LockMutex Lock;42pfnSDL_TryLockMutex TryLock;43pfnSDL_UnlockMutex Unlock;44// Needed by SDL_Condition:45SDL_MutexType Type;46} SDL_mutex_impl_t;4748extern SDL_mutex_impl_t SDL_mutex_impl_active;4950#ifndef SRWLOCK_INIT51#define SRWLOCK_INIT \52{ \530 \54}55typedef struct _SRWLOCK56{57PVOID Ptr;58} SRWLOCK, *PSRWLOCK;59#endif6061typedef struct SDL_mutex_srw62{63SRWLOCK srw;64// SRW Locks are not recursive, that has to be handled by SDL:65DWORD count;66DWORD owner;67} SDL_mutex_srw;6869typedef struct SDL_mutex_cs70{71CRITICAL_SECTION cs;72} SDL_mutex_cs;737475