eina_debug_timer code convention

This commit is contained in:
carlos 2020-04-17 11:38:13 -03:00 committed by João Paulo Taylor Ienczak Zanette
parent 1b3f60780e
commit 4cee97de7e
1 changed files with 35 additions and 38 deletions

View File

@ -160,9 +160,8 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
_timer_append(t); _timer_append(t);
if (!_thread_runs) if (!_thread_runs)
{ {
#ifndef _WIN32 #ifndef _WIN32
sigset_t oldset, newset; sigset_t oldset, newset;
sigemptyset(&newset); sigemptyset(&newset);
sigaddset(&newset, SIGPIPE); sigaddset(&newset, SIGPIPE);
sigaddset(&newset, SIGALRM); sigaddset(&newset, SIGALRM);
@ -173,16 +172,16 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
sigaddset(&newset, SIGQUIT); sigaddset(&newset, SIGQUIT);
sigaddset(&newset, SIGINT); sigaddset(&newset, SIGINT);
sigaddset(&newset, SIGTERM); sigaddset(&newset, SIGTERM);
# ifdef SIGPWR # ifdef SIGPWR
sigaddset(&newset, SIGPWR); sigaddset(&newset, SIGPWR);
# endif # endif
pthread_sigmask(SIG_BLOCK, &newset, &oldset); pthread_sigmask(SIG_BLOCK, &newset, &oldset);
#endif #endif
int err = pthread_create(&_thread, NULL, _monitor, NULL); int err = eina_thread_create(&_thread, NULL, _monitor, NULL);
#ifndef _WIN32 #ifndef _WIN32
pthread_sigmask(SIG_SETMASK, &oldset, NULL); pthread_sigmask(SIG_SETMASK, &oldset, NULL);
#endif #endif
if (err != 0) if (!err)
{ {
e_debug("EINA DEBUG ERROR: Can't create debug timer thread!"); e_debug("EINA DEBUG ERROR: Can't create debug timer thread!");
abort(); abort();
@ -211,8 +210,7 @@ _eina_debug_timer_init(void)
{ {
eina_spinlock_new(&_lock); eina_spinlock_new(&_lock);
#ifndef _WIN32 #ifndef _WIN32
if (pipe(pipeToThread) == -1) if (pipe(pipeToThread) == -1) return EINA_FALSE;
return EINA_FALSE;
#endif #endif
return EINA_TRUE; return EINA_TRUE;
} }
@ -227,8 +225,7 @@ _eina_debug_timer_shutdown(void)
free(t); free(t);
close(pipeToThread[0]); close(pipeToThread[0]);
close(pipeToThread[1]); close(pipeToThread[1]);
if (_thread_runs) if (_thread_runs) eina_thread_cancel(_thread);
eina_thread_cancel(_thread);
_thread_runs = 0; _thread_runs = 0;
eina_spinlock_release(&_lock); eina_spinlock_release(&_lock);
eina_spinlock_free(&_lock); eina_spinlock_free(&_lock);