aboutsummaryrefslogtreecommitdiff
path: root/src/universe.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/universe.h')
-rw-r--r--src/universe.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/universe.h b/src/universe.h
index 359dc90..8727bf7 100644
--- a/src/universe.h
+++ b/src/universe.h
@@ -24,6 +24,24 @@ typedef struct s_Lane Lane;
24 24
25// ################################################################################################ 25// ################################################################################################
26 26
27// everything we need to provide to lua_newstate()
28struct AllocatorDefinition_s
29{
30 lua_Alloc allocF;
31 void* allocUD;
32};
33typedef struct AllocatorDefinition_s AllocatorDefinition;
34
35// mutex-protected allocator for use with Lua states that share a non-threadsafe allocator
36struct ProtectedAllocator_s
37{
38 AllocatorDefinition definition;
39 MUTEX_T lock;
40};
41typedef struct ProtectedAllocator_s ProtectedAllocator;
42
43// ################################################################################################
44
27// everything regarding the a Lanes universe is stored in that global structure 45// everything regarding the a Lanes universe is stored in that global structure
28// held as a full userdata in the master Lua state that required it for the first time 46// held as a full userdata in the master Lua state that required it for the first time
29// don't forget to initialize all members in LG_configure() 47// don't forget to initialize all members in LG_configure()
@@ -34,8 +52,16 @@ struct s_Universe
34 52
35 bool_t demoteFullUserdata; 53 bool_t demoteFullUserdata;
36 54
55 // before a state is created, this function will be called to obtain the allocator
56 lua_CFunction provide_allocator;
57
58 // after a state is created, this function will be called right after the bases libraries are loaded
37 lua_CFunction on_state_create_func; 59 lua_CFunction on_state_create_func;
38 60
61 // Initialized and used only if allocator="protected" is found in the configuration settings
62 // contains a mutex and the original allocator definition
63 ProtectedAllocator protected_allocator;
64
39 Keepers* keepers; 65 Keepers* keepers;
40 66
41 // Initialized by 'init_once_LOCKED()': the deep userdata Linda object 67 // Initialized by 'init_once_LOCKED()': the deep userdata Linda object