Mercurial > gftp.yaz
comparison src/gtk/mkdir_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 | c8ec7877432e |
children | eec25f215772 |
comparison
equal
deleted
inserted
replaced
41:4bcfaf6307b5 | 42:cd169e4789df |
---|---|
19 | 19 |
20 #include "gftp-gtk.h" | 20 #include "gftp-gtk.h" |
21 static const char cvsid[] = "$Id$"; | 21 static const char cvsid[] = "$Id$"; |
22 | 22 |
23 static const char *edttext; | 23 static const char *edttext; |
24 static sigjmp_buf mkdirenvir; | |
25 | |
26 | |
27 static RETSIGTYPE | |
28 sig_mkdirquit (int signo) | |
29 { | |
30 signal (signo, sig_mkdirquit); | |
31 siglongjmp (mkdirenvir, signo == SIGINT ? 1 : 2); | |
32 } | |
33 | 24 |
34 | 25 |
35 static void * | 26 static void * |
36 do_make_dir_thread (void * data) | 27 do_make_dir_thread (void * data) |
37 { | 28 { |
41 wdata = data; | 32 wdata = data; |
42 wdata->request->user_data = (void *) 0x01; | 33 wdata->request->user_data = (void *) 0x01; |
43 | 34 |
44 if (wdata->request->use_threads) | 35 if (wdata->request->use_threads) |
45 { | 36 { |
46 sj = sigsetjmp (mkdirenvir, 1); | 37 sj = sigsetjmp (jmp_environment, 1); |
47 signal (SIGINT, sig_mkdirquit); | 38 use_jmp_environment = 1; |
48 signal (SIGALRM, sig_mkdirquit); | |
49 } | 39 } |
50 else | 40 else |
51 sj = 0; | 41 sj = 0; |
52 | 42 |
53 success = 0; | 43 success = 0; |
65 wdata->request->user_data, | 55 wdata->request->user_data, |
66 _("Operation canceled\n")); | 56 _("Operation canceled\n")); |
67 } | 57 } |
68 | 58 |
69 if (wdata->request->use_threads) | 59 if (wdata->request->use_threads) |
70 { | 60 use_jmp_environment = 0; |
71 signal (SIGINT, SIG_DFL); | |
72 signal (SIGALRM, SIG_IGN); | |
73 } | |
74 | 61 |
75 wdata->request->user_data = NULL; | 62 wdata->request->user_data = NULL; |
76 wdata->request->stopable = 0; | 63 wdata->request->stopable = 0; |
77 return ((void *) success); | 64 return ((void *) success); |
78 } | 65 } |