Software /
code /
prosody
Comparison
util-src/lsignal.c @ 2792:1b14388f1512
util.signal: Restore the old debug hook earlier, just in case we receive another signal between clearing the signal queue and restoring it
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 10 Jan 2010 03:54:29 +0000 |
parent | 2791:e23b642bdfd1 |
child | 2811:11df731e1b87 |
comparison
equal
deleted
inserted
replaced
2791:e23b642bdfd1 | 2792:1b14388f1512 |
---|---|
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) |