From f6171de1bd55c624681d2248d32905d151baf079 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 26 Oct 2004 21:48:37 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4439 --- api/boinc_api.C | 14 ++++++++++---- api/boinc_api.h | 1 + api/graphics_api.C | 12 +++++------- api/graphics_api.h | 2 ++ checkin_notes | 7 +++++++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 4ecff8e5ca..15fa804058 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -119,14 +119,22 @@ void BOINC_OPTIONS::defaults() { options.direct_process_action = true; } -// this is called ONLY by the worker thread +// the following 2 functions are used when there's no graphics // int boinc_init() { options.defaults(); return boinc_init_options(options); } - int boinc_init_options(BOINC_OPTIONS& opt) { + int retval; + retval = boinc_init_options_general(opt); + if (retval) return retval; + return set_worker_timer(); +} + +// the following can be called by either graphics or worker thread +// +int boinc_init_options_general(BOINC_OPTIONS& opt) { int retval; options = opt; @@ -193,8 +201,6 @@ int boinc_init_options(BOINC_OPTIONS& opt) { heartbeat_active = !standalone; heartbeat_giveup_time = dtime() + HEARTBEAT_GIVEUP_PERIOD; - set_worker_timer(); - return 0; } diff --git a/api/boinc_api.h b/api/boinc_api.h index 925a0d132d..e64916e19f 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -92,6 +92,7 @@ extern APP_CLIENT_SHM *app_client_shm; #ifdef _WIN32 extern HANDLE worker_thread_handle; #endif +extern int boinc_init_options_general(BOINC_OPTIONS& opt); extern int set_worker_timer(); /////////// IMPLEMENTATION STUFF ENDS HERE diff --git a/api/graphics_api.C b/api/graphics_api.C index 9bbfb9ebcb..2a9d90e8d2 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -62,19 +62,17 @@ bool graphics_inited = false; static void (*worker_main)(); -static BOINC_OPTIONS goptions; - #ifdef _WIN32 // glue routine for Windows DWORD WINAPI foobar(LPVOID) { - boinc_init_options(goptions); + set_worker_timer(); worker_main(); return 0; } #endif #ifdef _PTHREAD_H void* foobar(void*) { - boinc_init_options(goptions); + set_worker_timer(); worker_main(); return 0; } @@ -83,11 +81,11 @@ void* foobar(void*) { int boinc_init_graphics(void (*worker)()) { BOINC_OPTIONS opt; opt.defaults(); - boinc_init_options_graphics(opt, worker); + return boinc_init_options_graphics(opt, worker); } -int boinc_init_graphics_options(BOINC_OPTIONS& opt, void (*_worker_main)()) { - goptions = opt; +int boinc_init_options_graphics(BOINC_OPTIONS& opt, void (*_worker_main)()) { + boinc_init_options_general(opt); worker_main = _worker_main; #ifdef _WIN32 diff --git a/api/graphics_api.h b/api/graphics_api.h index 160f62fc8f..8ac3db1f96 100755 --- a/api/graphics_api.h +++ b/api/graphics_api.h @@ -1,6 +1,8 @@ #ifndef BOINC_GRAPHICS_API_H #define BOINC_GRAPHICS_API_H +struct BOINC_OPTIONS; + extern "C" { extern int boinc_init_graphics(void (*worker)()); extern int boinc_init_options_graphics(BOINC_OPTIONS&, void (*worker)()); diff --git a/checkin_notes b/checkin_notes index 6b112abe91..9b70febec8 100755 --- a/checkin_notes +++ b/checkin_notes @@ -18900,3 +18900,10 @@ Rom 26 Oct 2004 (boinc) - Tag for 4.52 release, all platforms boinc_core_release_4_52 + +David 26 Oct 2004 + - Further changes to graphics API + + api/ + boinc_api.C,h + graphics_api.C