Mercurial > gftp.yaz
comparison src/gtk/delete_dialog.c @ 42:cd169e4789df
2002-10-29 Brian Masney <masneyb@gftp.org>
* src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.c
src/gtk/gftp-gtk.h src/gtk/menu-items.c src/gtk/misc-gtk.c
src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c -
improved and simplified signal handling code
author | masneyb |
---|---|
date | Wed, 30 Oct 2002 03:34:37 +0000 |
parents | 4bcfaf6307b5 |
children | 311e29c40ed6 |
comparison
equal
deleted
inserted
replaced
41:4bcfaf6307b5 | 42:cd169e4789df |
---|---|
25 gftp_dialog_data * ddata ); | 25 gftp_dialog_data * ddata ); |
26 static void * do_delete_thread ( void *data ); | 26 static void * do_delete_thread ( void *data ); |
27 static void delete_purge_cache ( gpointer key, | 27 static void delete_purge_cache ( gpointer key, |
28 gpointer value, | 28 gpointer value, |
29 gpointer user_data ); | 29 gpointer user_data ); |
30 static RETSIGTYPE sig_delquit ( int signo ); | |
31 | |
32 static sigjmp_buf delenvir; | |
33 | 30 |
34 void | 31 void |
35 delete_dialog (gpointer data) | 32 delete_dialog (gpointer data) |
36 { | 33 { |
37 gftp_file * tempfle, * newfle; | 34 gftp_file * tempfle, * newfle; |
194 transfer = data; | 191 transfer = data; |
195 transfer->fromreq->user_data = (void *) 0x01; | 192 transfer->fromreq->user_data = (void *) 0x01; |
196 | 193 |
197 if (transfer->fromreq->use_threads) | 194 if (transfer->fromreq->use_threads) |
198 { | 195 { |
199 sj = sigsetjmp (delenvir, 1); | 196 sj = sigsetjmp (jmp_environment, 1); |
200 signal (SIGINT, sig_delquit); | 197 use_jmp_environment = 1; |
201 signal (SIGALRM, sig_delquit); | |
202 } | 198 } |
203 else | 199 else |
204 sj = 0; | 200 sj = 0; |
205 | 201 |
206 if (sj == 0) | 202 if (sj == 0) |
247 | 243 |
248 transfer->fromreq->user_data = NULL; | 244 transfer->fromreq->user_data = NULL; |
249 transfer->fromreq->stopable = 0; | 245 transfer->fromreq->stopable = 0; |
250 | 246 |
251 if (transfer->fromreq->use_threads) | 247 if (transfer->fromreq->use_threads) |
252 { | 248 use_jmp_environment = 0; |
253 signal (SIGINT, SIG_DFL); | |
254 signal (SIGALRM, SIG_IGN); | |
255 } | |
256 | 249 |
257 return (NULL); | 250 return (NULL); |
258 } | 251 } |
259 | 252 |
260 | 253 |
270 gftp_delete_cache_entry (request); | 263 gftp_delete_cache_entry (request); |
271 request->directory = olddir; | 264 request->directory = olddir; |
272 g_free (key); | 265 g_free (key); |
273 } | 266 } |
274 | 267 |
275 | |
276 static RETSIGTYPE | |
277 sig_delquit (int signo) | |
278 { | |
279 signal (signo, sig_delquit); | |
280 siglongjmp (delenvir, signo == SIGINT ? 1 : 2); | |
281 } | |
282 |