src/luaevent.c

changeset 67
7fd8dbfb54d5
parent 66
0173c0fc0cf0
child 68
9e119bf833ae
equal deleted inserted replaced
66:0173c0fc0cf0 67:7fd8dbfb54d5
89 return 1; 89 return 1;
90 } 90 }
91 91
92 static int luaevent_loopexit(lua_State*L) { 92 static int luaevent_loopexit(lua_State*L) {
93 le_base *base = event_base_get(L, 1); 93 le_base *base = event_base_get(L, 1);
94 struct timeval tv = { 0, 10 }; 94 struct timeval tv = { 0, 0 };
95 if(lua_gettop(L) >= 2) /* Optional timeout before exiting the loop */
96 load_timeval(luaL_checknumber(L, 2), &tv);
95 int ret = event_base_loopexit(base->base, &tv); 97 int ret = event_base_loopexit(base->base, &tv);
96 lua_pushinteger(L, ret); 98 lua_pushinteger(L, ret);
97 return 1; 99 return 1;
98 } 100 }
99 101

mercurial