From 4705e2fb15ae58cc47a3df100949b07931d53526 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 11 Sep 2015 17:04:28 +0900 Subject: [PATCH] fix cancellation --- ChangeLog | 5 +++++ chopstx.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd2f6ce..91d3cde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-09-11 Niibe Yutaka + + * chopstx.c (chx_init, chopstx_create): Fix the initial value + of flag_cancelable. + 2015-09-10 Niibe Yutaka * VERSION: 0.09. diff --git a/chopstx.c b/chopstx.c index bf335bb..07d9854 100644 --- a/chopstx.c +++ b/chopstx.c @@ -637,7 +637,8 @@ chx_init (struct chx_thread *tp) tp->mutex_list = NULL; tp->clp = NULL; tp->state = THREAD_RUNNING; - tp->flag_got_cancel = tp->flag_join_req = tp->flag_cancelable = 0; + tp->flag_got_cancel = tp->flag_join_req = 0; + tp->flag_cancelable = 1; tp->flag_sched_rr = (CHX_FLAGS_MAIN & CHOPSTX_SCHED_RR)? 1 : 0; tp->flag_detached = (CHX_FLAGS_MAIN & CHOPSTX_DETACHED)? 1 : 0; tp->prio_orig = CHX_PRIO_MAIN_INIT; @@ -817,7 +818,8 @@ chopstx_create (uint32_t flags_and_prio, tp->mutex_list = NULL; tp->clp = NULL; tp->state = THREAD_EXITED; - tp->flag_got_cancel = tp->flag_join_req = tp->flag_cancelable = 0; + tp->flag_got_cancel = tp->flag_join_req = 0; + tp->flag_cancelable = 1; tp->flag_sched_rr = (flags_and_prio & CHOPSTX_SCHED_RR)? 1 : 0; tp->flag_detached = (flags_and_prio & CHOPSTX_DETACHED)? 1 : 0; tp->prio_orig = tp->prio = prio;