Don't work on mutexes or conditions if threads are stopped

This commit is contained in:
James R 2020-08-15 20:52:16 -07:00
parent 346f5c95f5
commit db417a8761
1 changed files with 15 additions and 0 deletions

View File

@ -284,6 +284,9 @@ I_lock_mutex (
){
SDL_mutex * mutex;
if (! i_threads_running.value)
return;
mutex = Identity(
&i_mutex_pool,
i_mutex_pool_mutex,
@ -299,6 +302,9 @@ void
I_unlock_mutex (
I_mutex id
){
if (! i_threads_running.value)
return;
if (SDL_UnlockMutex(id) == -1)
abort();
}
@ -310,6 +316,9 @@ I_hold_cond (
){
SDL_cond * cond;
if (! i_threads_running.value)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
@ -327,6 +336,9 @@ I_wake_one_cond (
){
SDL_cond * cond;
if (! i_threads_running.value)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
@ -344,6 +356,9 @@ I_wake_all_cond (
){
SDL_cond * cond;
if (! i_threads_running.value)
return;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,