Make mutex and cond functions no-op with NULL pointers

This commit is contained in:
James R 2020-08-24 04:34:18 -07:00
parent 83560485d1
commit 7fcbe073c3

View file

@ -297,6 +297,9 @@ I_lock_mutex (
if (! i_threads_running.value)
return;
if (anchor == NULL)
return;
mutex = Identity(
&i_mutex_pool,
i_mutex_pool_mutex,
@ -315,6 +318,9 @@ I_unlock_mutex (
if (! i_threads_running.value)
return;
if (id == NULL)
return;
if (SDL_UnlockMutex(id) == -1)
abort();
}
@ -329,6 +335,9 @@ I_hold_cond (
if (! i_threads_running.value)
return;
if (cond_anchor == NULL || mutex_id == NULL)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
@ -349,6 +358,9 @@ I_wake_one_cond (
if (! i_threads_running.value)
return;
if (anchor == NULL)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
@ -369,6 +381,9 @@ I_wake_all_cond (
if (! i_threads_running.value)
return;
if (anchor == NULL)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,