Lines Matching refs:mutex

40     SDL_mutex *mutex;  in SDL_CreateMutex()  local
43 mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex)); in SDL_CreateMutex()
44 if (mutex) { in SDL_CreateMutex()
46 mutex->sem = SDL_CreateSemaphore(1); in SDL_CreateMutex()
47 mutex->recursive = 0; in SDL_CreateMutex()
48 mutex->owner = 0; in SDL_CreateMutex()
49 if (!mutex->sem) { in SDL_CreateMutex()
50 SDL_free(mutex); in SDL_CreateMutex()
51 mutex = NULL; in SDL_CreateMutex()
56 return mutex; in SDL_CreateMutex()
61 SDL_DestroyMutex(SDL_mutex * mutex) in SDL_DestroyMutex() argument
63 if (mutex) { in SDL_DestroyMutex()
64 if (mutex->sem) { in SDL_DestroyMutex()
65 SDL_DestroySemaphore(mutex->sem); in SDL_DestroyMutex()
67 SDL_free(mutex); in SDL_DestroyMutex()
73 SDL_LockMutex(SDL_mutex * mutex) in SDL_LockMutex() argument
80 if (mutex == NULL) { in SDL_LockMutex()
85 if (mutex->owner == this_thread) { in SDL_LockMutex()
86 ++mutex->recursive; in SDL_LockMutex()
92 SDL_SemWait(mutex->sem); in SDL_LockMutex()
93 mutex->owner = this_thread; in SDL_LockMutex()
94 mutex->recursive = 0; in SDL_LockMutex()
103 SDL_TryLockMutex(SDL_mutex * mutex) in SDL_TryLockMutex() argument
111 if (mutex == NULL) { in SDL_TryLockMutex()
116 if (mutex->owner == this_thread) { in SDL_TryLockMutex()
117 ++mutex->recursive; in SDL_TryLockMutex()
123 retval = SDL_SemWait(mutex->sem); in SDL_TryLockMutex()
125 mutex->owner = this_thread; in SDL_TryLockMutex()
126 mutex->recursive = 0; in SDL_TryLockMutex()
136 SDL_mutexV(SDL_mutex * mutex) in SDL_mutexV() argument
141 if (mutex == NULL) { in SDL_mutexV()
146 if (SDL_ThreadID() != mutex->owner) { in SDL_mutexV()
150 if (mutex->recursive) { in SDL_mutexV()
151 --mutex->recursive; in SDL_mutexV()
158 mutex->owner = 0; in SDL_mutexV()
159 SDL_SemPost(mutex->sem); in SDL_mutexV()