diff options
Diffstat (limited to 'src/linda.cpp')
-rw-r--r-- | src/linda.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/linda.cpp b/src/linda.cpp index 87aa8fa..dafac56 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
@@ -226,19 +226,19 @@ void Linda::setName(std::string_view const& name_) | |||
226 | LUAG_FUNC(linda_cancel) | 226 | LUAG_FUNC(linda_cancel) |
227 | { | 227 | { |
228 | Linda* const _linda{ ToLinda<false>(L_, 1) }; | 228 | Linda* const _linda{ ToLinda<false>(L_, 1) }; |
229 | char const* _who{ luaL_optstring(L_, 2, "both") }; | 229 | std::string_view const _who{ luaL_optstringview(L_, 2, "both") }; |
230 | // make sure we got 3 arguments: the linda, a key and a limit | 230 | // make sure we got 2 arguments: the linda and the cancellation mode |
231 | luaL_argcheck(L_, lua_gettop(L_) <= 2, 2, "wrong number of arguments"); | 231 | luaL_argcheck(L_, lua_gettop(L_) <= 2, 2, "wrong number of arguments"); |
232 | 232 | ||
233 | _linda->cancelRequest = CancelRequest::Soft; | 233 | _linda->cancelRequest = CancelRequest::Soft; |
234 | if (strcmp(_who, "both") == 0) { // tell everyone writers to wake up | 234 | if (_who == "both") { // tell everyone writers to wake up |
235 | _linda->writeHappened.notify_all(); | 235 | _linda->writeHappened.notify_all(); |
236 | _linda->readHappened.notify_all(); | 236 | _linda->readHappened.notify_all(); |
237 | } else if (strcmp(_who, "none") == 0) { // reset flag | 237 | } else if (_who == "none") { // reset flag |
238 | _linda->cancelRequest = CancelRequest::None; | 238 | _linda->cancelRequest = CancelRequest::None; |
239 | } else if (strcmp(_who, "read") == 0) { // tell blocked readers to wake up | 239 | } else if (_who == "read") { // tell blocked readers to wake up |
240 | _linda->writeHappened.notify_all(); | 240 | _linda->writeHappened.notify_all(); |
241 | } else if (strcmp(_who, "write") == 0) { // tell blocked writers to wake up | 241 | } else if (_who == "write") { // tell blocked writers to wake up |
242 | _linda->readHappened.notify_all(); | 242 | _linda->readHappened.notify_all(); |
243 | } else { | 243 | } else { |
244 | raise_luaL_error(L_, "unknown wake hint '%s'", _who); | 244 | raise_luaL_error(L_, "unknown wake hint '%s'", _who); |