aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-12-06 01:10:59 +0000
committerMatthew Wild <mwild1@gmail.com>2009-12-06 01:10:59 +0000
commit7eb84245607020b20fcf83404a7e4e93fc0a3f89 (patch)
treee5b7041126dfcfaf146f7600f5bae386bc7ae328
parent2575f4cbf0124aa21568f76a243980c679587759 (diff)
downloadluaevent-prosody-7eb84245607020b20fcf83404a7e4e93fc0a3f89.tar.gz
luaevent-prosody-7eb84245607020b20fcf83404a7e4e93fc0a3f89.zip
Add base:loopexit() method
-rw-r--r--src/luaevent.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/luaevent.c b/src/luaevent.c
index c9b5430..71188a6 100644
--- a/src/luaevent.c
+++ b/src/luaevent.c
@@ -89,9 +89,18 @@ static int luaevent_loop(lua_State* L) {
return 1;
}
+static int luaevent_loopexit(lua_State*L) {
+ le_base *base = event_base_get(L, 1);
+ struct timeval tv = { 0, 10 };
+ int ret = event_base_loopexit(base->base, &tv);
+ lua_pushinteger(L, ret);
+ return 1;
+}
+
static luaL_Reg base_funcs[] = {
{ "addevent", luaevent_addevent },
{ "loop", luaevent_loop },
+ { "loopexit", luaevent_loopexit },
{ NULL, NULL }
};