From e0dbd33c2d4776d6b2213dd82f344166eafde438 Mon Sep 17 00:00:00 2001
From: Benoit Germain
Date: Tue, 1 Aug 2017 09:40:44 +0200
Subject: Fix for deep-aware modules
Don't crash when using a module that creates Lanes-compatible deep
userdata.
Added a sample deep-aware module.
---
docs/index.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'docs')
diff --git a/docs/index.html b/docs/index.html
index feee273..703fa69 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -70,7 +70,7 @@
- This document was revised on 5-Jun-17, and applies to version 3.11.
+ This document was revised on 1-Aug-17, and applies to version 3.12.
@@ -1527,9 +1527,9 @@ events to a common Linda, but... :).
eDO_metatable: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (eDO_metatable should only be invoked once per state). Push the metatable on the stack, then call luaG_pushdeepversion() before returning (new in version 3.9.5).
eDO_module: requests the name of the module that exports the idfunc, 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 idfunc pointer is still held.
- Take a look at linda_id in lanes.c.
+ Take a look at linda_id in lanes.c or deep_test_id in deep_test.c.
- Include "deep.h" and either link against Lanes or statically compile deep.c into your module if you want to avoid a runtime dependency for users that will use your module without Lanes.
+ Include "deep.h" and either link against Lanes or statically compile deep.c and universe.c into your module if you want to avoid a runtime dependency for users that will use your module without Lanes.
Instanciate your userdata using luaG_newdeepuserdata(), instead of the regular lua_newuserdata(). Given an idfunc, 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.
Accessing the deep userdata from your C code, use luaG_todeep() instead of the regular lua_touserdata().
--
cgit v1.2.3-55-g6feb