diff options
-rw-r--r-- | src/lanes.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lanes.c b/src/lanes.c index ba9e59a..aef023e 100644 --- a/src/lanes.c +++ b/src/lanes.c | |||
@@ -1938,7 +1938,12 @@ static void init_once_LOCKED( lua_State *L, volatile DEEP_PRELUDE ** timer_deep_ | |||
1938 | *timer_deep_ref= * (DEEP_PRELUDE**) lua_touserdata( L, -1 ); | 1938 | *timer_deep_ref= * (DEEP_PRELUDE**) lua_touserdata( L, -1 ); |
1939 | ASSERT_L( (*timer_deep_ref) && (*timer_deep_ref)->refcount==1 && (*timer_deep_ref)->deep ); | 1939 | ASSERT_L( (*timer_deep_ref) && (*timer_deep_ref)->refcount==1 && (*timer_deep_ref)->deep ); |
1940 | 1940 | ||
1941 | lua_pop(L,1); // we don't need the proxy | 1941 | // The host Lua state must always have a reference to this Linda object in order for our 'timer_deep_ref' to be valid. |
1942 | // So store a reference that we will never actually use. | ||
1943 | lua_pushlightuserdata(L, (void *)init_once_LOCKED); | ||
1944 | lua_insert(L, -2); // Swap key with the Linda object | ||
1945 | lua_rawset(L, LUA_REGISTRYINDEX); | ||
1946 | |||
1942 | } | 1947 | } |
1943 | STACK_END(L,0) | 1948 | STACK_END(L,0) |
1944 | } | 1949 | } |