aboutsummaryrefslogtreecommitdiff
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
parent08cca6b9f8d7d3253868be758deef9280fc949c5 (diff)
chopstx_join is cancellation point.
-rw-r--r--ChangeLog5
-rw-r--r--chopstx.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 169634b..c430ea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-12 NIIBE Yutaka <gniibe@fsij.org>
+
+ * chopstx.c (chopstx_join, chopstx_cancel): chopstx_join is
+ cancellation point.
+
2016-07-11 NIIBE Yutaka <gniibe@fsij.org>
* mcu/stm32f103.h: Add more from Gnuk 1.1.9.
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)