aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/keeper.cpp')
-rw-r--r--src/keeper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 0aea18e..9718bda 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -14,7 +14,7 @@
14 --[[ 14 --[[
15 =============================================================================== 15 ===============================================================================
16 16
17 Copyright (C) 2011-2023 Benoit Germain <bnt.germain@gmail.com> 17 Copyright (C) 2011-2024 Benoit Germain <bnt.germain@gmail.com>
18 18
19 Permission is hereby granted, free of charge, to any person obtaining a copy 19 Permission is hereby granted, free of charge, to any person obtaining a copy
20 of this software and associated documentation files (the "Software"), to deal 20 of this software and associated documentation files (the "Software"), to deal
@@ -207,10 +207,10 @@ static void push_table(lua_State* L, int idx_)
207 207
208// ################################################################################################## 208// ##################################################################################################
209 209
210int keeper_push_linda_storage(Universe* U, lua_State* L, void* ptr_, uintptr_t magic_) 210int keeper_push_linda_storage(Universe* U, Dest L, void* ptr_, uintptr_t magic_)
211{ 211{
212 Keeper* const K{ which_keeper(U->keepers, magic_) }; 212 Keeper* const K{ which_keeper(U->keepers, magic_) };
213 lua_State* const KL{ K ? K->L : nullptr }; 213 Source const KL{ K ? K->L : nullptr };
214 if (KL == nullptr) 214 if (KL == nullptr)
215 return 0; 215 return 0;
216 STACK_GROW(KL, 4); 216 STACK_GROW(KL, 4);
@@ -412,7 +412,7 @@ int keepercall_limit(lua_State* L)
412 // set the new limit 412 // set the new limit
413 fifo->limit = limit; 413 fifo->limit = limit;
414 // return 0 or 1 value 414 // return 0 or 1 value
415 return lua_gettop( L); 415 return lua_gettop(L);
416} 416}
417 417
418// ################################################################################################## 418// ##################################################################################################
@@ -485,7 +485,7 @@ int keepercall_set(lua_State* L)
485 lua_insert(L, 3); // fifos key fifotbl [val [, ...]] 485 lua_insert(L, 3); // fifos key fifotbl [val [, ...]]
486 fifo_push(L, fifo, count); // fifos key fifotbl 486 fifo_push(L, fifo, count); // fifos key fifotbl
487 } 487 }
488 return should_wake_writers ? (lua_pushboolean( L, 1), 1) : 0; 488 return should_wake_writers ? (lua_pushboolean(L, 1), 1) : 0;
489} 489}
490 490
491// ################################################################################################## 491// ##################################################################################################
@@ -717,7 +717,7 @@ void init_keepers(Universe* U, lua_State* L)
717 if (!lua_isnil(L, -1)) 717 if (!lua_isnil(L, -1))
718 { 718 {
719 // when copying with mode LookupMode::ToKeeper, error message is pushed at the top of the stack, not raised immediately 719 // when copying with mode LookupMode::ToKeeper, error message is pushed at the top of the stack, not raised immediately
720 if (luaG_inter_copy_package(U, L, K, -1, LookupMode::ToKeeper)) 720 if (luaG_inter_copy_package(U, Source{ L }, Dest{ K }, -1, LookupMode::ToKeeper))
721 { 721 {
722 // if something went wrong, the error message is at the top of the stack 722 // if something went wrong, the error message is at the top of the stack
723 lua_remove(L, -2); // error_msg 723 lua_remove(L, -2); // error_msg
@@ -840,7 +840,7 @@ int keeper_call(Universe* U, lua_State* K, keeper_api_t func_, lua_State* L, voi
840 840
841 lua_pushlightuserdata(K, linda); 841 lua_pushlightuserdata(K, linda);
842 842
843 if ((args == 0) || luaG_inter_copy(U, L, K, args, LookupMode::ToKeeper) == 0) // L->K 843 if ((args == 0) || luaG_inter_copy(U, Source{ L }, Dest{ K }, args, LookupMode::ToKeeper) == 0) // L->K
844 { 844 {
845 lua_call(K, 1 + args, LUA_MULTRET); 845 lua_call(K, 1 + args, LUA_MULTRET);
846 retvals = lua_gettop(K) - Ktos; 846 retvals = lua_gettop(K) - Ktos;
@@ -848,7 +848,7 @@ int keeper_call(Universe* U, lua_State* K, keeper_api_t func_, lua_State* L, voi
848 // this may interrupt a lane, causing the destruction of the underlying OS thread 848 // this may interrupt a lane, causing the destruction of the underlying OS thread
849 // after this, another lane making use of this keeper can get an error code from the mutex-locking function 849 // after this, another lane making use of this keeper can get an error code from the mutex-locking function
850 // when attempting to grab the mutex again (WINVER <= 0x400 does this, but locks just fine, I don't know about pthread) 850 // when attempting to grab the mutex again (WINVER <= 0x400 does this, but locks just fine, I don't know about pthread)
851 if ((retvals > 0) && luaG_inter_move(U, K, L, retvals, LookupMode::FromKeeper) != 0) // K->L 851 if ((retvals > 0) && luaG_inter_move(U, Source{ K }, Dest{ L }, retvals, LookupMode::FromKeeper) != 0) // K->L
852 { 852 {
853 retvals = -1; 853 retvals = -1;
854 } 854 }