aboutsummaryrefslogtreecommitdiff
path: root/src/cancel.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cancel.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/cancel.cpp b/src/cancel.cpp
index e80c0b5..9887cba 100644
--- a/src/cancel.cpp
+++ b/src/cancel.cpp
@@ -111,8 +111,7 @@ LUAG_FUNC(cancel_test)
111{ 111{
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 {
116 std::condition_variable* const waiting_on{ lane_->m_waiting_on }; 115 std::condition_variable* const waiting_on{ lane_->m_waiting_on };
117 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) { 116 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) {
118 waiting_on->notify_all(); 117 waiting_on->notify_all();
@@ -128,8 +127,7 @@ LUAG_FUNC(cancel_test)
128{ 127{
129 lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop 128 lane_->cancel_request = CancelRequest::Hard; // it's now signaled to stop
130 // lane_->m_thread.get_stop_source().request_stop(); 129 // lane_->m_thread.get_stop_source().request_stop();
131 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
132 {
133 std::condition_variable* waiting_on = lane_->m_waiting_on; 131 std::condition_variable* waiting_on = lane_->m_waiting_on;
134 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) { 132 if (lane_->m_status == Lane::Waiting && waiting_on != nullptr) {
135 waiting_on->notify_all(); 133 waiting_on->notify_all();
@@ -209,8 +207,7 @@ LUAG_FUNC(thread_cancel)
209 CancelOp const op{ which_cancel_op(L_, 2) }; // this removes the op string from the stack 207 CancelOp const op{ which_cancel_op(L_, 2) }; // this removes the op string from the stack
210 208
211 int hook_count{ 0 }; 209 int hook_count{ 0 };
212 if (static_cast<int>(op) > static_cast<int>(CancelOp::Soft)) // hook is requested 210 if (static_cast<int>(op) > static_cast<int>(CancelOp::Soft)) { // hook is requested
213 {
214 hook_count = static_cast<int>(luaL_checkinteger(L_, 2)); 211 hook_count = static_cast<int>(luaL_checkinteger(L_, 2));
215 lua_remove(L_, 2); // argument is processed, remove it 212 lua_remove(L_, 2); // argument is processed, remove it
216 if (hook_count < 1) { 213 if (hook_count < 1) {