itimer: Don't free condvar until we know ticker is stopped
authorBen Gamari <ben@smart-cactus.org>
Wed, 9 Jan 2019 05:20:19 +0000 (00:20 -0500)
committerBen Gamari <ben@well-typed.com>
Mon, 14 Jan 2019 14:30:40 +0000 (09:30 -0500)
commit7b12b3f0240321ac1ee43f14eb9c07e015022eeb
treec9e64a4f36784bfd0dd091471f47cf442d34fdb2
parent4ad9ffd3897924313fb509515c60b4f09429e5cf
itimer: Don't free condvar until we know ticker is stopped

When we are shutting down the pthread ticker we signal the start_cond condition
variable to ensure that the ticker thread wakes up and exits in a reasonable
amount of time. Previously, when the ticker thread would shut down it was
responsible for freeing the start_cond condition variable. However, this would
lead to a race wherein the ticker would free start_cond, then the main thread
would try to signal it in an effort to wake the ticker (#16150).

Avoid this by moving the mutex destruction to the main thread.
rts/posix/itimer/Pthread.c