Skip to content

Commit 2986f4d

Browse files
authored
fix the problem that butex_wake does not signal pending tasks (#13)
1 parent c9b7ad5 commit 2986f4d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/bthread/condition_variable.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern "C" {
4343

4444
extern int bthread_mutex_unlock(bthread_mutex_t*);
4545
extern int bthread_mutex_lock_contended(bthread_mutex_t*);
46+
extern void bthread_flush();
4647

4748
int bthread_cond_init(bthread_cond_t* __restrict c,
4849
const bthread_condattr_t*) {
@@ -67,6 +68,8 @@ int bthread_cond_signal(bthread_cond_t* c) {
6768
// don't touch ic any more
6869
bool no_signal = true;
6970
bthread::butex_wake(saved_seq, no_signal);
71+
// flush unsignaled tasks manually
72+
bthread_flush();
7073
return 0;
7174
}
7275

0 commit comments

Comments
 (0)