aboutsummaryrefslogtreecommitdiff
path: root/chopstx.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2016-10-12 12:06:37 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2016-10-12 12:06:37 +0900
commitbc664fe94357301499294678de9b415ca05e2ef5 (patch)
tree49fd7c8435f90cf11645631f69af0172a440665f /chopstx.c
parent08cca6b9f8d7d3253868be758deef9280fc949c5 (diff)
chopstx_join is cancellation point.
Diffstat (limited to 'chopstx.c')
-rw-r--r--chopstx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/chopstx.c b/chopstx.c
index 6d9de04..2f7189f 100644
--- a/chopstx.c
+++ b/chopstx.c
@@ -1559,6 +1559,8 @@ chopstx_join (chopstx_t thd, void **ret)
* We don't offer deadlock detection. It's users' responsibility.
*/
+ chopstx_testcancel ();
+
chx_cpu_sched_lock ();
if (tp->flag_detached)
{
@@ -1661,7 +1663,7 @@ chopstx_cancel (chopstx_t thd)
return;
}
- /* Cancellation points: cond_wait, usec_wait, and poll. */
+ /* Cancellation points: cond_wait, usec_wait, join, and poll. */
if (tp->state == THREAD_WAIT_CND)
{
struct chx_cond *cond = (struct chx_cond *)tp->parent;
@@ -1672,6 +1674,12 @@ chopstx_cancel (chopstx_t thd)
}
else if (tp->state == THREAD_WAIT_TIME)
chx_timer_dequeue (tp);
+ else if (tp->state == THREAD_WAIT_EXIT)
+ {
+ chx_spin_lock (&q_join.lock);
+ ll_dequeue ((struct chx_pq *)tp);
+ chx_spin_unlock (&q_join.lock);
+ }
else if (tp->state == THREAD_WAIT_POLL)
{
if (tp->parent == &q_timer.q)