lua rock events crash on error in main state
on errors thread stack overflows yielding before thread_exit() is a bad idea apparently Change-Id: Iac45d4321fac496738384fdbbeb480356ef2a1bb
This commit is contained in:
parent
3b75f98700
commit
3d06d35bf6
1 changed files with 4 additions and 3 deletions
|
@ -72,6 +72,7 @@
|
||||||
#define EVENT_METATABLE "event metatable"
|
#define EVENT_METATABLE "event metatable"
|
||||||
|
|
||||||
#define EVENT_THREAD LUA_ROCKEVENTSNAME ".thread"
|
#define EVENT_THREAD LUA_ROCKEVENTSNAME ".thread"
|
||||||
|
#define EV_STACKSZ DEFAULT_STACK_SIZE
|
||||||
|
|
||||||
#define LUA_SUCCESS 0
|
#define LUA_SUCCESS 0
|
||||||
#define EV_TIMER_FREQ (TIMER_FREQ / HZ)
|
#define EV_TIMER_FREQ (TIMER_FREQ / HZ)
|
||||||
|
@ -323,7 +324,7 @@ event_error:
|
||||||
|
|
||||||
/* thread is exiting -- clean up */
|
/* thread is exiting -- clean up */
|
||||||
rb->timer_unregister();
|
rb->timer_unregister();
|
||||||
rb->yield();
|
//rb->yield();
|
||||||
rb->thread_exit();
|
rb->thread_exit();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -360,7 +361,7 @@ static void create_event_thread_ref(struct event_data *ev_data)
|
||||||
|
|
||||||
lua_createtable(L, 2, 0);
|
lua_createtable(L, 2, 0);
|
||||||
|
|
||||||
ev_data->event_stack = (long *) lua_newuserdata (L, DEFAULT_STACK_SIZE);
|
ev_data->event_stack = (long *) lua_newuserdata (L, EV_STACKSZ);
|
||||||
|
|
||||||
/* attach EVENT_METATABLE to ud so we get notified on garbage collection */
|
/* attach EVENT_METATABLE to ud so we get notified on garbage collection */
|
||||||
luaL_getmetatable (L, EVENT_METATABLE);
|
luaL_getmetatable (L, EVENT_METATABLE);
|
||||||
|
@ -412,7 +413,7 @@ static void init_event_thread(bool init, struct event_data *ev_data)
|
||||||
|
|
||||||
ev_data->thread_id = rb->create_thread(&event_thread,
|
ev_data->thread_id = rb->create_thread(&event_thread,
|
||||||
ev_data->event_stack,
|
ev_data->event_stack,
|
||||||
DEFAULT_STACK_SIZE,
|
EV_STACKSZ,
|
||||||
0,
|
0,
|
||||||
EVENT_THREAD
|
EVENT_THREAD
|
||||||
IF_PRIO(, PRIORITY_SYSTEM)
|
IF_PRIO(, PRIORITY_SYSTEM)
|
||||||
|
|
Loading…
Reference in a new issue