API bug fix

svn path=/trunk/boinc/; revision=7277
This commit is contained in:
David Anderson 2005-08-11 21:26:02 +00:00
parent 8b195ca1c7
commit a2ddb241a4
4 changed files with 24 additions and 6 deletions

View File

@ -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$";

View File

@ -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);

View File

@ -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;
}

View File

@ -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