Mon, 07 Dec 2009 21:36:31 +0000
base:loopexit(): Support for specifying the timeout before exit
src/luaevent.c | file | annotate | diff | comparison | revisions |
--- a/src/luaevent.c Sun Dec 06 01:10:59 2009 +0000 +++ b/src/luaevent.c Mon Dec 07 21:36:31 2009 +0000 @@ -91,7 +91,9 @@ static int luaevent_loopexit(lua_State*L) { le_base *base = event_base_get(L, 1); - struct timeval tv = { 0, 10 }; + struct timeval tv = { 0, 0 }; + if(lua_gettop(L) >= 2) /* Optional timeout before exiting the loop */ + load_timeval(luaL_checknumber(L, 2), &tv); int ret = event_base_loopexit(base->base, &tv); lua_pushinteger(L, ret); return 1;