From 6b93c4cc691e7ca0ec3e3073b6f91439706f59f7 Mon Sep 17 00:00:00 2001
From: Benoit Germain
Date: Wed, 11 Dec 2024 10:36:35 +0100
Subject: Remove documentation wrongitudes
---
docs/index.html | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
(limited to 'docs')
diff --git a/docs/index.html b/docs/index.html
index 8bb181f..bfa2615 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1893,15 +1893,15 @@ class MyDeepFactory : public DeepFactory
static MyDeepFactory g_MyDeepFactory;
- - newDeepObjectInternal: requests the creation of a new object, whose pointer is returned. Said object must derive from DeepPrelude.
- - deleteDeepObjectInternal: should cleanup the object.
- - createMetatable: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (createMetatable should only be invoked once per state). Just push the metatable on the stack.
- - moduleName: requests the name of the module that exports the factory, to be returned. It is necessary so that Lanes can require it in any lane state that receives a userdata. This is to prevent crashes in situations where the module could be unloaded while the factory pointer is still held.
+ - newDeepObjectInternal(): requests the creation of a new object, whose pointer is returned. Said object must derive from DeepPrelude.
+ - deleteDeepObjectInternal(): should cleanup the object.
+ - createMetatable(): should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (createMetatable should only be invoked once per state). Just push the metatable on the stack.
+ - moduleName(): requests the name of the module that exports the factory, to be returned. It is necessary so that Lanes can require it in any lane state that receives a userdata. This is to prevent crashes in situations where the module could be unloaded while the factory pointer is still held.
Take a look at LindaFactory in lindafactory.cpp or MyDeepFactory in deep_test.cpp.
Include "_pch.hpp", "deep.hpp" and either link against Lanes or statically compile compat.cpp deep.cpp into your module if you want to avoid a runtime dependency for users that will use your module without Lanes.
- Instanciate your userdata using yourFactoryObject.pushDeepUserdata(), instead of the regular lua_newuserdata(). Given a factory, it sets up the support structures and returns a state-specific proxy userdata for accessing your data. This proxy can also be copied over to other lanes.
+ Instanciate your userdata using yourFactoryObject.pushDeepUserdata(), instead of the regular lua_newuserdata(). Given a factory, it sets up the support structures and returns a state-specific proxy full userdata for accessing your data. This proxy can also be copied over to other lanes.
Accessing the deep userdata from your C code, use yourFactoryObject.toDeep() instead of the regular lua_touserdata().
To push an existing proxy on the stack, use DeepPrelude::push(L).
@@ -1911,10 +1911,8 @@ static MyDeepFactory g_MyDeepFactory;
- Deep userdata in transit inside Keeper states (sent in a linda but not yet consumed) don't call deleteDeepObjectInternal and aren't considered by reference counting. The rationale is the following:
- If some non-keeper state holds a deep userdata for some deep object, then even if the keeper collects its own deep userdata, it shouldn't be cleaned up since the refcount is not 0.
- OTOH, if a keeper state holds the last deep userdata for some deep object, then no lane can do actual work with it. Deep userdata's factory() interface is never accessed from a keeper state.
- Therefore, Lanes can just call deleteDeepObjectInternal when the last non-keeper-held deep userdata is collected, as long as it doesn't do the same in a keeper state after that, since any remaining deep userdata in Keeper states now hold stale pointers.
+ Pay attention to the fact a deep userdata last proxy can be held inside a Keeper state after being stored in a Linda and all other references are lost.
+ If the Linda then flushes its contents through garbage collection in the Keeper state or by being collected itself, it means that deleteDeepObjectInternal() can be called from inside a Keeper state.
--
cgit v1.2.3-55-g6feb