Fix thread safety attributes for TryLock functions
Changed SDL_TRY_ACQUIRE and SDL_TRY_ACQUIRE_SHARED success value from 0 to true for functions that now return bool instead of int. This fixes false positives/negatives in Clang's thread safety analysis.
This commit is contained in:
committed by
Sam Lantinga
parent
f844f3e10b
commit
901173aee6
@@ -360,7 +360,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut
|
|||||||
* \sa SDL_LockMutex
|
* \sa SDL_LockMutex
|
||||||
* \sa SDL_UnlockMutex
|
* \sa SDL_UnlockMutex
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex);
|
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(true, mutex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock the mutex.
|
* Unlock the mutex.
|
||||||
@@ -559,7 +559,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD
|
|||||||
* \sa SDL_TryLockRWLockForWriting
|
* \sa SDL_TryLockRWLockForWriting
|
||||||
* \sa SDL_UnlockRWLock
|
* \sa SDL_UnlockRWLock
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock);
|
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(true, rwlock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to lock a read/write lock _for writing_ without blocking.
|
* Try to lock a read/write lock _for writing_ without blocking.
|
||||||
@@ -589,7 +589,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock)
|
|||||||
* \sa SDL_TryLockRWLockForReading
|
* \sa SDL_TryLockRWLockForReading
|
||||||
* \sa SDL_UnlockRWLock
|
* \sa SDL_UnlockRWLock
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock);
|
extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(true, rwlock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlock the read/write lock.
|
* Unlock the read/write lock.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#ifdef SDL_THREAD_SAFETY_ANALYSIS
|
#ifdef SDL_THREAD_SAFETY_ANALYSIS
|
||||||
extern SDL_Mutex *SDL_HIDAPI_rumble_lock;
|
extern SDL_Mutex *SDL_HIDAPI_rumble_lock;
|
||||||
#endif
|
#endif
|
||||||
bool SDL_HIDAPI_LockRumble(void) SDL_TRY_ACQUIRE(0, SDL_HIDAPI_rumble_lock);
|
bool SDL_HIDAPI_LockRumble(void) SDL_TRY_ACQUIRE(true, SDL_HIDAPI_rumble_lock);
|
||||||
bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **data, int **size, int *maximum_size);
|
bool SDL_HIDAPI_GetPendingRumbleLocked(SDL_HIDAPI_Device *device, Uint8 **data, int **size, int *maximum_size);
|
||||||
int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size) SDL_RELEASE(SDL_HIDAPI_rumble_lock);
|
int SDL_HIDAPI_SendRumbleAndUnlock(SDL_HIDAPI_Device *device, const Uint8 *data, int size) SDL_RELEASE(SDL_HIDAPI_rumble_lock);
|
||||||
typedef void (*SDL_HIDAPI_RumbleSentCallback)(void *userdata);
|
typedef void (*SDL_HIDAPI_RumbleSentCallback)(void *userdata);
|
||||||
|
|||||||
Reference in New Issue
Block a user