aboutsummaryrefslogtreecommitdiff
path: root/src/cancel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cancel.cpp')
-rw-r--r--src/cancel.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cancel.cpp b/src/cancel.cpp
index 9887cba..ed450f0 100644
--- a/src/cancel.cpp
+++ b/src/cancel.cpp
@@ -112,8 +112,8 @@ LUAG_FUNC(cancel_test)
112 lane_->cancel_request = CancelRequest::Soft; // it's now signaled to stop 112 lane_->cancel_request = CancelRequest::Soft; // it's now signaled to stop
113 // negative timeout: we don't want to truly abort the lane, we just want it to react to cancel_test() on its own 113 // negative timeout: we don't want to truly abort the lane, we just want it to react to cancel_test() on its own
114 if (wakeLane_) { // wake the thread so that execution returns from any pending linda operation if desired 114 if (wakeLane_) { // wake the thread so that execution returns from any pending linda operation if desired
115 std::condition_variable* const waiting_on{ lane_->m_waiting_on }; 115 std::condition_variable* const waiting_on{ lane_->waiting_on };
116 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) { 116 if (lane_->status == Lane::Waiting && waiting_on != nullptr) {
117 waiting_on->notify_all(); 117 waiting_on->notify_all();
118 } 118 }
119 } 119 }
@@ -126,10 +126,10 @@ LUAG_FUNC(cancel_test)
126[[nodiscard]] static CancelResult thread_cancel_hard(Lane* lane_, lua_Duration duration_, bool wakeLane_) 126[[nodiscard]] static CancelResult thread_cancel_hard(Lane* lane_, lua_Duration duration_, bool wakeLane_)
127{ 127{
128 lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop 128 lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop
129 // lane_->m_thread.get_stop_source().request_stop(); 129 // lane_->thread.get_stop_source().request_stop();
130 if (wakeLane_) { // wake the thread so that execution returns from any pending linda operation if desired 130 if (wakeLane_) { // wake the thread so that execution returns from any pending linda operation if desired
131 std::condition_variable* waiting_on = lane_->m_waiting_on; 131 std::condition_variable* waiting_on = lane_->waiting_on;
132 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) { 132 if (lane_->status == Lane::Waiting && waiting_on != nullptr) {
133 waiting_on->notify_all(); 133 waiting_on->notify_all();
134 } 134 }
135 } 135 }
@@ -144,7 +144,7 @@ CancelResult thread_cancel(Lane* lane_, CancelOp op_, int hookCount_, lua_Durati
144{ 144{
145 // remember that lanes are not transferable: only one thread can cancel a lane, so no multithreading issue here 145 // remember that lanes are not transferable: only one thread can cancel a lane, so no multithreading issue here
146 // We can read 'lane_->status' without locks, but not wait for it (if Posix no PTHREAD_TIMEDJOIN) 146 // We can read 'lane_->status' without locks, but not wait for it (if Posix no PTHREAD_TIMEDJOIN)
147 if (lane_->m_status >= Lane::Done) { 147 if (lane_->status >= Lane::Done) {
148 // say "ok" by default, including when lane is already done 148 // say "ok" by default, including when lane is already done
149 return CancelResult::Cancelled; 149 return CancelResult::Cancelled;
150 } 150 }