util-src/signal.c

changeset 2432
1e045b3e9dce
parent 2431
c4d32b35fe60
child 2459
66f60e69567b
equal deleted inserted replaced
2431:c4d32b35fe60 2432:1e045b3e9dce
163 163
164 static struct signal_event *last_event = NULL; 164 static struct signal_event *last_event = NULL;
165 165
166 static void sighook(lua_State *L, lua_Debug *ar) 166 static void sighook(lua_State *L, lua_Debug *ar)
167 { 167 {
168 /* restore the old hook */
169 lua_sethook(L, Hsig, Hmask, Hcount);
170
168 lua_pushstring(L, LUA_SIGNAL); 171 lua_pushstring(L, LUA_SIGNAL);
169 lua_gettable(L, LUA_REGISTRYINDEX); 172 lua_gettable(L, LUA_REGISTRYINDEX);
170 173
171 struct signal_event *event; 174 struct signal_event *event;
172 while((event = signal_queue)) 175 while((event = signal_queue))
178 free(event); 181 free(event);
179 }; 182 };
180 183
181 lua_pop(L, 1); /* pop lua_signal table */ 184 lua_pop(L, 1); /* pop lua_signal table */
182 185
183 /* restore the old hook */
184 lua_sethook(L, Hsig, Hmask, Hcount);
185 } 186 }
186 187
187 static void handle(int sig) 188 static void handle(int sig)
188 { 189 {
189 if(!signal_queue) 190 if(!signal_queue)

mercurial