diff options
Diffstat (limited to '')
-rw-r--r-- | src/cancel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cancel.cpp b/src/cancel.cpp index 15a2c83..2cd3c53 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp | |||
@@ -103,7 +103,7 @@ CancelOp WhichCancelOp(std::string_view const& opString_) | |||
103 | 103 | ||
104 | // ################################################################################################# | 104 | // ################################################################################################# |
105 | 105 | ||
106 | [[nodiscard]] static CancelOp WhichCancelOp(lua_State* const L_, int const idx_) | 106 | [[nodiscard]] static CancelOp WhichCancelOp(lua_State* const L_, StackIndex const idx_) |
107 | { | 107 | { |
108 | if (luaG_type(L_, idx_) == LuaType::STRING) { | 108 | if (luaG_type(L_, idx_) == LuaType::STRING) { |
109 | std::string_view const _str{ luaG_tostring(L_, idx_) }; | 109 | std::string_view const _str{ luaG_tostring(L_, idx_) }; |
@@ -141,8 +141,8 @@ LUAG_FUNC(cancel_test) | |||
141 | // bool[,reason] = lane_h:cancel( [mode, hookcount] [, timeout] [, wake_lane]) | 141 | // bool[,reason] = lane_h:cancel( [mode, hookcount] [, timeout] [, wake_lane]) |
142 | LUAG_FUNC(thread_cancel) | 142 | LUAG_FUNC(thread_cancel) |
143 | { | 143 | { |
144 | Lane* const _lane{ ToLane(L_, 1) }; | 144 | Lane* const _lane{ ToLane(L_, StackIndex{ 1 }) }; |
145 | CancelOp const _op{ WhichCancelOp(L_, 2) }; // this removes the op string from the stack | 145 | CancelOp const _op{ WhichCancelOp(L_, StackIndex{ 2 }) }; // this removes the op string from the stack |
146 | 146 | ||
147 | int _hook_count{ 0 }; | 147 | int _hook_count{ 0 }; |
148 | if (static_cast<int>(_op) > static_cast<int>(CancelOp::Soft)) { // hook is requested | 148 | if (static_cast<int>(_op) > static_cast<int>(CancelOp::Soft)) { // hook is requested |
@@ -154,12 +154,12 @@ LUAG_FUNC(thread_cancel) | |||
154 | } | 154 | } |
155 | 155 | ||
156 | std::chrono::time_point<std::chrono::steady_clock> _until{ std::chrono::time_point<std::chrono::steady_clock>::max() }; | 156 | std::chrono::time_point<std::chrono::steady_clock> _until{ std::chrono::time_point<std::chrono::steady_clock>::max() }; |
157 | if (luaG_type(L_, 2) == LuaType::NUMBER) { // we don't want to use lua_isnumber() because of autocoercion | 157 | if (luaG_type(L_, StackIndex{ 2 }) == LuaType::NUMBER) { // we don't want to use lua_isnumber() because of autocoercion |
158 | lua_Duration const duration{ lua_tonumber(L_, 2) }; | 158 | lua_Duration const duration{ lua_tonumber(L_, 2) }; |
159 | if (duration.count() >= 0.0) { | 159 | if (duration.count() >= 0.0) { |
160 | _until = std::chrono::steady_clock::now() + std::chrono::duration_cast<std::chrono::steady_clock::duration>(duration); | 160 | _until = std::chrono::steady_clock::now() + std::chrono::duration_cast<std::chrono::steady_clock::duration>(duration); |
161 | } else { | 161 | } else { |
162 | raise_luaL_argerror(L_, 2, "duration cannot be < 0"); | 162 | raise_luaL_argerror(L_, StackIndex{ 2 }, "duration cannot be < 0"); |
163 | } | 163 | } |
164 | lua_remove(L_, 2); // argument is processed, remove it | 164 | lua_remove(L_, 2); // argument is processed, remove it |
165 | } else if (lua_isnil(L_, 2)) { // alternate explicit "infinite timeout" by passing nil before the key | 165 | } else if (lua_isnil(L_, 2)) { // alternate explicit "infinite timeout" by passing nil before the key |