aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-12-07 21:36:31 +0000
committerMatthew Wild <mwild1@gmail.com>2009-12-07 21:36:31 +0000
commitb797f511efc3843cf32d62f907f1cfa08fca3828 (patch)
tree614d8257dff4871d9dae741b0c138e0daf44dc2c /src
parent7eb84245607020b20fcf83404a7e4e93fc0a3f89 (diff)
downloadluaevent-prosody-b797f511efc3843cf32d62f907f1cfa08fca3828.tar.gz
luaevent-prosody-b797f511efc3843cf32d62f907f1cfa08fca3828.zip
base:loopexit(): Support for specifying the timeout before exit
Diffstat (limited to 'src')
-rw-r--r--src/luaevent.c4
1 files changed, 3 insertions, 1 deletions
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;