Create cond if it doesn't exist when signaling

This commit is contained in:
James R 2020-04-27 18:01:27 -07:00
parent 00ffb29f95
commit 5fff4c35fc
2 changed files with 24 additions and 6 deletions

View File

@ -32,8 +32,8 @@ void I_unlock_mutex (I_mutex);
void I_hold_cond (I_cond *, I_mutex);
void I_wake_one_cond (I_cond);
void I_wake_all_cond (I_cond);
void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *);
#endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/

View File

@ -323,16 +323,34 @@ I_hold_cond (
void
I_wake_one_cond (
I_cond id
I_cond * anchor
){
if (SDL_CondSignal(id) == -1)
SDL_cond * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
);
if (SDL_CondSignal(cond) == -1)
abort();
}
void
I_wake_all_cond (
I_cond id
I_cond * anchor
){
if (SDL_CondBroadcast(id) == -1)
SDL_cond * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
);
if (SDL_CondBroadcast(cond) == -1)
abort();
}