diff --git a/api/boinc_api.C b/api/boinc_api.C index 023060a836..787f12fbfa 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -619,6 +619,7 @@ static void worker_timer(int /*a*/) { #ifndef _WIN32 void* timer_thread(void*) { + block_sigalrm(); while(1) { boinc_sleep(TIMER_PERIOD); worker_timer(0); @@ -789,4 +790,15 @@ void boinc_fpops_cumulative(double x) { fpops_cumulative = x; } +#ifndef _WIN32 +// block SIGALRM, so that the worker thread will be forced to handle it +// +void block_sigalrm() { + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + pthread_sigmask(SIG_BLOCK, &mask, NULL); +} +#endif + const char *BOINC_RCSID_0fa0410386 = "$Id$"; diff --git a/api/boinc_api.h b/api/boinc_api.h index d3307ac352..3b90e48e13 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -118,6 +118,8 @@ extern void options_defaults(BOINC_OPTIONS&); extern APP_CLIENT_SHM *app_client_shm; #ifdef _WIN32 extern HANDLE worker_thread_handle; +#else +extern void block_sigalrm(); #endif extern int boinc_init_options_general(BOINC_OPTIONS& opt); extern int set_worker_timer(void); diff --git a/api/graphics_impl.C b/api/graphics_impl.C index 182379c1e8..50b1ec8bd2 100755 --- a/api/graphics_impl.C +++ b/api/graphics_impl.C @@ -141,12 +141,7 @@ int start_worker_thread(WORKER_FUNC_PTR _worker_main) { if (retval) return ERR_THREAD; pthread_attr_destroy( &worker_thread_attr ); - // block SIGLARM, so that the worker thread will be forced to handle it - // - sigset_t mask; - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - pthread_sigmask(SIG_BLOCK, &mask, NULL); + block_sigalrm(); #endif return 0; } diff --git a/checkin_notes b/checkin_notes index a6d93aa12d..1ef4f91ee8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -10403,3 +10403,12 @@ Rom 11 Aug 2005 ValidateAccountKey.cpp ValidateURL.cpp WizAttachProject.cpp, .h + +David 11 Aug 2005 + - API bug fix: block SIGALRM in timer thread + (make new function block_sigalrm(); + call it from graphics, timer thread) + + api/ + boinc_api.C,h + graphics_impl.C