From b797f511efc3843cf32d62f907f1cfa08fca3828 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 7 Dec 2009 21:36:31 +0000 Subject: base:loopexit(): Support for specifying the timeout before exit --- src/luaevent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaevent.c b/src/luaevent.c index 71188a6..550a386 100644 --- a/src/luaevent.c +++ b/src/luaevent.c @@ -91,7 +91,9 @@ static int luaevent_loop(lua_State* L) { 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; -- cgit v1.2.3