mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Fix bug we added to *NSYNC a while ago
This is believed to fix a crash, that's possible in nsync_waiter_free_() when you call pthread_cond_timedwait(), or nsync_cv_wait_with_deadline() where an assertion can fail. Thanks ipv4.games for helping me find this!
This commit is contained in:
parent
f3ce684aef
commit
111ec9a989
1 changed files with 2 additions and 1 deletions
3
third_party/nsync/mem/nsync_cv.c
vendored
3
third_party/nsync/mem/nsync_cv.c
vendored
|
@ -233,7 +233,9 @@ static int nsync_cv_wait_with_deadline_impl_ (struct nsync_cv_wait_with_deadline
|
|||
/* Requeue on *pmu using existing waiter struct; current thread
|
||||
is the designated waker. */
|
||||
nsync_mu_lock_slow_ (c->cv_mu, c->w, MU_DESIG_WAKER, c->w->l_type);
|
||||
nsync_waiter_free_ (c->w);
|
||||
} else {
|
||||
nsync_waiter_free_ (c->w);
|
||||
/* Traditional case: We've woken from the cv, and need to reacquire *pmu. */
|
||||
if (c->is_reader_mu) {
|
||||
nsync_mu_rlock (c->cv_mu);
|
||||
|
@ -241,7 +243,6 @@ static int nsync_cv_wait_with_deadline_impl_ (struct nsync_cv_wait_with_deadline
|
|||
(*c->lock) (c->pmu);
|
||||
}
|
||||
}
|
||||
nsync_waiter_free_ (c->w);
|
||||
IGNORE_RACES_END ();
|
||||
return (outcome);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue