src/luaevent.c

changeset 66
0173c0fc0cf0
parent 64
dd47dbe85bec
child 67
7fd8dbfb54d5
equal deleted inserted replaced
65:e65466cee871 66:0173c0fc0cf0
87 int ret = event_base_loop(base->base, 0); 87 int ret = event_base_loop(base->base, 0);
88 lua_pushinteger(L, ret); 88 lua_pushinteger(L, ret);
89 return 1; 89 return 1;
90 } 90 }
91 91
92 static int luaevent_loopexit(lua_State*L) {
93 le_base *base = event_base_get(L, 1);
94 struct timeval tv = { 0, 10 };
95 int ret = event_base_loopexit(base->base, &tv);
96 lua_pushinteger(L, ret);
97 return 1;
98 }
99
92 static luaL_Reg base_funcs[] = { 100 static luaL_Reg base_funcs[] = {
93 { "addevent", luaevent_addevent }, 101 { "addevent", luaevent_addevent },
94 { "loop", luaevent_loop }, 102 { "loop", luaevent_loop },
103 { "loopexit", luaevent_loopexit },
95 { NULL, NULL } 104 { NULL, NULL }
96 }; 105 };
97 106
98 static luaL_Reg funcs[] = { 107 static luaL_Reg funcs[] = {
99 { "new", luaevent_newbase }, 108 { "new", luaevent_newbase },

mercurial