summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-11 23:13:13 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-11 23:13:13 +0900
commit659d5d28945a6b7e417e9ee0debfdcbacdbbe443 (patch)
tree28611cd355fb1b61f4490165b83a1ec07a414935
parente88bbaa1e314751e5c1a04dec7f1f179188428ae (diff)
ecore signal - since we arent going to use threads due to osx, remove
remove thread code since osx is not happy with threads trapping signals (or at least a thread setting up the handler and trapping there with signal blocks...). this should now work universally.
-rw-r--r--src/lib/ecore/ecore_signal.c61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c
index e640704212..bfc0933474 100644
--- a/src/lib/ecore/ecore_signal.c
+++ b/src/lib/ecore/ecore_signal.c
@@ -20,18 +20,12 @@
20/* make mono happy - this is evil though... */ 20/* make mono happy - this is evil though... */
21#undef SIGPWR 21#undef SIGPWR
22 22
23//#define ECORE_SIGNAL_THREAD 1
24
25static void _ecore_signal_exe_exit_delay(void *data, const Efl_Event *event); 23static void _ecore_signal_exe_exit_delay(void *data, const Efl_Event *event);
26static void _ecore_signal_waitpid(Eina_Bool once, siginfo_t info); 24static void _ecore_signal_waitpid(Eina_Bool once, siginfo_t info);
27static void _ecore_signal_generic_free(void *data, void *event); 25static void _ecore_signal_generic_free(void *data, void *event);
28 26
29typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo); 27typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);
30 28
31#ifdef ECORE_SIGNAL_THREAD
32static Eina_Thread sig_thread;
33static Eina_Bool sig_thread_exists = EINA_FALSE;
34#endif
35static int sig_pipe[2] = { -1, -1 }; // [0] == read, [1] == write 29static int sig_pipe[2] = { -1, -1 }; // [0] == read, [1] == write
36static Eo *sig_pipe_handler = NULL; 30static Eo *sig_pipe_handler = NULL;
37 31
@@ -150,10 +144,6 @@ _ecore_signal_callback(int sig, siginfo_t *si, void *foo EINA_UNUSED)
150{ 144{
151 Signal_Data sdata; 145 Signal_Data sdata;
152 146
153#ifdef ECORE_SIGNAL_THREAD
154 if (eina_thread_self() != sig_thread)
155 fprintf(stderr, "Ecore sig handler NOT called from sigwatcher thread\n");
156#endif
157 sdata.sig = sig; 147 sdata.sig = sig;
158 sdata.info = *si; 148 sdata.info = *si;
159 if (sdata.sig >= 0) 149 if (sdata.sig >= 0)
@@ -211,18 +201,6 @@ _signalhandler_setup(void)
211#endif 201#endif
212} 202}
213 203
214#ifdef ECORE_SIGNAL_THREAD
215static void *
216_ecore_signal_thread_watcher(void *data EINA_UNUSED, Eina_Thread t)
217{
218 eina_thread_cancellable_set(EINA_FALSE, NULL);
219 eina_thread_name_set(t, "Esigwatcher");
220 _signalhandler_setup();
221 for (;;) pause();
222 return NULL;
223}
224#endif
225
226static void 204static void
227_ecore_signal_pipe_init(void) 205_ecore_signal_pipe_init(void)
228{ 206{
@@ -237,23 +215,7 @@ _ecore_signal_pipe_init(void)
237 eina_file_close_on_exec(sig_pipe[1], EINA_TRUE); 215 eina_file_close_on_exec(sig_pipe[1], EINA_TRUE);
238 fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK); 216 fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK);
239 } 217 }
240#ifdef ECORE_SIGNAL_THREAD
241 if (!sig_thread_exists)
242 {
243 if (!eina_thread_create(&sig_thread, EINA_THREAD_NORMAL,
244 -1, _ecore_signal_thread_watcher, NULL))
245 {
246 close(sig_pipe[0]);
247 close(sig_pipe[1]);
248 sig_pipe[0] = -1;
249 sig_pipe[1] = -1;
250 return;
251 }
252 sig_thread_exists = EINA_TRUE;
253 }
254#else
255 _signalhandler_setup(); 218 _signalhandler_setup();
256#endif
257 if (!sig_pipe_handler) 219 if (!sig_pipe_handler)
258 sig_pipe_handler = 220 sig_pipe_handler =
259 efl_add(EFL_LOOP_HANDLER_CLASS, ML_OBJ, 221 efl_add(EFL_LOOP_HANDLER_CLASS, ML_OBJ,
@@ -283,35 +245,12 @@ static void
283_ecore_signal_cb_fork(void *data EINA_UNUSED) 245_ecore_signal_cb_fork(void *data EINA_UNUSED)
284{ 246{
285 _ecore_signal_pipe_shutdown(); 247 _ecore_signal_pipe_shutdown();
286#ifdef ECORE_SIGNAL_THREAD
287 sig_thread_exists = EINA_FALSE;
288#endif
289 _ecore_signal_pipe_init(); 248 _ecore_signal_pipe_init();
290} 249}
291 250
292void 251void
293_ecore_signal_init(void) 252_ecore_signal_init(void)
294{ 253{
295#ifdef ECORE_SIGNAL_THREAD
296# ifndef _WIN32
297 sigset_t newset;
298
299 sigemptyset(&newset);
300 sigaddset(&newset, SIGPIPE);
301 sigaddset(&newset, SIGALRM);
302 sigaddset(&newset, SIGCHLD);
303 sigaddset(&newset, SIGUSR1);
304 sigaddset(&newset, SIGUSR2);
305 sigaddset(&newset, SIGHUP);
306 sigaddset(&newset, SIGQUIT);
307 sigaddset(&newset, SIGINT);
308 sigaddset(&newset, SIGTERM);
309# ifdef SIGPWR
310 sigaddset(&newset, SIGPWR);
311# endif
312 pthread_sigmask(SIG_BLOCK, &newset, NULL);
313# endif
314#endif
315 _ecore_signal_pipe_init(); 254 _ecore_signal_pipe_init();
316 ecore_fork_reset_callback_add(_ecore_signal_cb_fork, NULL); 255 ecore_fork_reset_callback_add(_ecore_signal_cb_fork, NULL);
317} 256}