Create cond if it doesn't exist when signaling

This commit is contained in:
James R committed 2020-04-27 18:01:27 -07:00
1 parent 88bcac0168
commit bdddeb9ecf
2 files changed
+24 -6

No files matched your search

+2 -2
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*/
+22 -4
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();
}