Skip to content
Snippets Groups Projects
Commit de33ecf4 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'stable'

Conflicts:
	test/box/test_init.lua
parents b443f554 e81e2842
No related branches found
No related tags found
No related merge requests found
......@@ -818,6 +818,13 @@ load_init_script(va_list ap)
{
struct lua_State *L = va_arg(ap, struct lua_State *);
/*
* Return control to tarantool_lua_load_init_script.
* tarantool_lua_load_init_script when will start an auxiliary event
* loop and re-schedule this fiber.
*/
fiber_sleep(0.0);
char path[PATH_MAX + 1];
snprintf(path, PATH_MAX, "%s/%s",
cfg.script_dir, TARANTOOL_LUA_INIT_SCRIPT);
......@@ -835,6 +842,12 @@ load_init_script(va_list ap)
* The file doesn't exist. It's OK, tarantool may
* have no init file.
*/
/*
* Lua script finished. Stop the auxiliary event loop and
* return control back to tarantool_lua_load_init_script.
*/
ev_break(EVBREAK_ALL);
}
/**
......@@ -878,6 +891,13 @@ tarantool_lua_load_init_script(struct lua_State *L)
struct fiber *loader = fiber_new(TARANTOOL_LUA_INIT_SCRIPT,
load_init_script);
fiber_call(loader, L);
/*
* Run an auxiliary event loop to re-schedule load_init_script fiber.
* When this fiber finishes, it will call ev_break to stop the loop.
*/
ev_run(0);
/* Outside the startup file require() or ffi are not
* allowed.
*/
......
......@@ -33,3 +33,11 @@ box.fiber.resume(fiber)
--
space:insert(2, 4, 8, 16)
--
-- A test case for https://github.com/tarantool/tarantool/issues/53
--
assert (require ~= nil)
box.fiber.sleep(0.0)
assert (require ~= nil)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment