blob: c0bbab44483efa275e997082fbd2b33625a03aec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
local lanes = require("lanes").configure{ with_timers = false}
local l = lanes.linda "my linda"
-- we will transfer userdata created by this module, so we need to make Lanes aware of it
local dt = lanes.require "deep_test"
local test_deep = true
local test_clonable = false
local performTest = function( obj_)
obj_:set(666)
print( "immediate:", obj_)
l:set( "key", obj_)
local out = l:get( "key")
print( "out of linda:", out)
local g = lanes.gen(
"package"
, {
required = { "deep_test"} -- we will transfer userdata created by this module, so we need to make this lane aware of it
}
, function( obj_)
print( "in lane:", obj_)
return obj_
end
)
h = g( obj_)
local from_lane = h[1]
print( "from lane:", from_lane)
end
if test_deep then
performTest( dt.new_deep())
end
if test_clonable then
performTest( dt.new_clonable())
end
|