aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.c')
-rw-r--r--src/lanes.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lanes.c b/src/lanes.c
index 2ad9bd9..90da9bf 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -114,7 +114,7 @@ static void securize_debug_threadname( lua_State* L, Lane* s)
114{ 114{
115 STACK_CHECK( L, 0); 115 STACK_CHECK( L, 0);
116 STACK_GROW( L, 3); 116 STACK_GROW( L, 3);
117 lua_getuservalue( L, 1); 117 lua_getiuservalue( L, 1, 1);
118 lua_newtable( L); 118 lua_newtable( L);
119 // Lua 5.1 can't do 's->debug_name = lua_pushstring( L, s->debug_name);' 119 // Lua 5.1 can't do 's->debug_name = lua_pushstring( L, s->debug_name);'
120 lua_pushstring( L, s->debug_name); 120 lua_pushstring( L, s->debug_name);
@@ -1376,7 +1376,8 @@ LUAG_FUNC( lane_new)
1376 1376
1377 // 's' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread) 1377 // 's' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread)
1378 // 1378 //
1379 ud = lua_newuserdata( L, sizeof( Lane*)); // func libs cancelstep priority globals package required gc_cb lane 1379 // a Lane full userdata needs a single uservalue
1380 ud = lua_newuserdatauv( L, sizeof( Lane*), 1); // func libs cancelstep priority globals package required gc_cb lane
1380 s = *ud = (Lane*) malloc( sizeof( Lane)); 1381 s = *ud = (Lane*) malloc( sizeof( Lane));
1381 if( s == NULL) 1382 if( s == NULL)
1382 { 1383 {
@@ -1422,7 +1423,7 @@ LUAG_FUNC( lane_new)
1422 lua_rawset( L, -3); // func libs cancelstep priority globals package required gc_cb lane uv 1423 lua_rawset( L, -3); // func libs cancelstep priority globals package required gc_cb lane uv
1423 } 1424 }
1424 1425
1425 lua_setuservalue( L, -2); // func libs cancelstep priority globals package required gc_cb lane 1426 lua_setiuservalue( L, -2, 1); // func libs cancelstep priority globals package required gc_cb lane
1426 1427
1427 // Store 's' in the lane's registry, for 'cancel_test()' (even if 'cs'==0 we still do cancel tests at pending send/receive). 1428 // Store 's' in the lane's registry, for 'cancel_test()' (even if 'cs'==0 we still do cancel tests at pending send/receive).
1428 REGISTRY_SET( L2, CANCEL_TEST_KEY, lua_pushlightuserdata( L2, s)); // func [... args ...] 1429 REGISTRY_SET( L2, CANCEL_TEST_KEY, lua_pushlightuserdata( L2, s)); // func [... args ...]
@@ -1461,7 +1462,7 @@ LUAG_FUNC( thread_gc)
1461 Lane* s = lua_toLane( L, 1); // ud 1462 Lane* s = lua_toLane( L, 1); // ud
1462 1463
1463 // if there a gc callback? 1464 // if there a gc callback?
1464 lua_getuservalue( L, 1); // ud uservalue 1465 lua_getiuservalue( L, 1, 1); // ud uservalue
1465 push_unique_key( L, GCCB_KEY); // ud uservalue __gc 1466 push_unique_key( L, GCCB_KEY); // ud uservalue __gc
1466 lua_rawget( L, -2); // ud uservalue gc_cb|nil 1467 lua_rawget( L, -2); // ud uservalue gc_cb|nil
1467 if( !lua_isnil( L, -1)) 1468 if( !lua_isnil( L, -1))
@@ -1724,7 +1725,7 @@ LUAG_FUNC( thread_index)
1724 // first, check that we don't already have an environment that holds the requested value 1725 // first, check that we don't already have an environment that holds the requested value
1725 { 1726 {
1726 // If key is found in the uservalue, return it 1727 // If key is found in the uservalue, return it
1727 lua_getuservalue( L, UD); 1728 lua_getiuservalue( L, UD, 1);
1728 lua_pushvalue( L, KEY); 1729 lua_pushvalue( L, KEY);
1729 lua_rawget( L, USR); 1730 lua_rawget( L, USR);
1730 if( !lua_isnil( L, -1)) 1731 if( !lua_isnil( L, -1))