aboutsummaryrefslogtreecommitdiff
path: root/src/deep.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/deep.h')
-rw-r--r--src/deep.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/deep.h b/src/deep.h
index 5322525..878fa63 100644
--- a/src/deep.h
+++ b/src/deep.h
@@ -16,6 +16,8 @@ extern "C" {
16#include "lanesconf.h" 16#include "lanesconf.h"
17#include "uniquekey.h" 17#include "uniquekey.h"
18 18
19#include <atomic>
20
19// forwards 21// forwards
20struct Universe; 22struct Universe;
21 23
@@ -38,8 +40,8 @@ using luaG_IdFunction = void*( lua_State* L, DeepOp op_);
38 40
39// ################################################################################################ 41// ################################################################################################
40 42
41// fnv164 of string "DEEP_VERSION_2" generated at https://www.pelock.com/products/hash-calculator 43// xxh64 of string "DEEP_VERSION_3" generated at https://www.pelock.com/products/hash-calculator
42static constexpr UniqueKey DEEP_VERSION{ 0xB4B0119C10642B29ull }; 44static constexpr UniqueKey DEEP_VERSION{ 0xB2CC0FD9C0AE9674ull };
43 45
44// should be used as header for full userdata 46// should be used as header for full userdata
45struct DeepPrelude 47struct DeepPrelude
@@ -48,10 +50,10 @@ struct DeepPrelude
48 // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc 50 // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc
49 luaG_IdFunction* idfunc { nullptr }; 51 luaG_IdFunction* idfunc { nullptr };
50 // data is destroyed when refcount is 0 52 // data is destroyed when refcount is 0
51 volatile int refcount{ 0 }; 53 std::atomic<int> m_refcount{ 0 };
52}; 54};
53 55
54char const* push_deep_proxy( Universe* U, lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_); 56char const* push_deep_proxy(lua_State* L, DeepPrelude* prelude, int nuv_, LookupMode mode_);
55void free_deep_prelude( lua_State* L, DeepPrelude* prelude_); 57void free_deep_prelude( lua_State* L, DeepPrelude* prelude_);
56 58
57LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction* idfunc, int nuv_); 59LANES_API int luaG_newdeepuserdata( lua_State* L, luaG_IdFunction* idfunc, int nuv_);