From 960d40f916fd2a75cc224933729b5c19197b1702 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 15 Mar 2006 19:27:37 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=9654 --- api/boinc_api.C | 8 ++++++++ api/boinc_api.h | 4 +++- checkin_notes | 7 +++++++ doc/api.php | 8 ++++++-- doc/compound_app.php | 6 +++--- doc/links.php | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index 723b101b3f..25279f529f 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -822,6 +822,14 @@ int boinc_fraction_done(double x) { return 0; } +// for use by graphics code. +// Caller should check for values outside [0..1]; +// that means undefined (no information available). +// +double boinc_get_fraction_done() { + return fraction_done; +} + int boinc_receive_trickle_down(char* buf, int len) { std::string filename; char path[256]; diff --git a/api/boinc_api.h b/api/boinc_api.h index e386cfd2a9..c9301e8b7c 100755 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -25,6 +25,7 @@ #endif // ANSI C API BEGINS HERE +// Do not put implementation stuff here #ifdef __cplusplus extern "C" { @@ -66,7 +67,6 @@ struct BOINC_STATUS { extern int boinc_init(void); extern int boinc_finish(int status); -extern void boinc_exit (int status); extern int boinc_resolve_filename(const char*, char*, int len); extern int boinc_parse_init_data_file(void); extern int boinc_write_init_data_file(void); @@ -92,6 +92,7 @@ extern int boinc_receive_trickle_down(char* buf, int len); extern int boinc_init_options(BOINC_OPTIONS*); extern int boinc_get_status(BOINC_STATUS*); #endif +extern double boinc_get_fraction_done(); #ifdef __APPLE__ extern int setMacPList(void); @@ -128,6 +129,7 @@ extern int suspend_activities(void); extern int resume_activities(void); extern int restore_activities(void); extern int boinc_init_options_general(BOINC_OPTIONS& opt); +extern void boinc_exit(int status); extern int set_worker_timer(void); extern void (*stop_graphics_thread_ptr)(); diff --git a/checkin_notes b/checkin_notes index 7639fc8b7a..57dc1a5893 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2851,3 +2851,10 @@ Rom 14 Mar 2006 client/ acct_mgr.C + +David 15 Mar 2006 + - API: add boinc_get_fraction_done(): call this from graphics thread + to get latest fraction done reported by worker thread. + + api/ + boinc_api.C,h diff --git a/doc/api.php b/doc/api.php index 62a91aba35..8746dc0cfd 100644 --- a/doc/api.php +++ b/doc/api.php @@ -187,10 +187,14 @@ To keep this display current, an application should periodically call The fraction_done argument is an estimate of the workunit fraction complete (0 to 1). This function is fast and can be called frequently. -The sequence of arguments in successive calls should -be non-decreasing. +The sequence of arguments in successive calls should be non-decreasing. An application should never 'reset' and start over if an error occurs; it should exit with an error code. +
+   double boinc_get_fraction_done();
+
+returns the last value set, or -1 if none has been set +(this would typically be called from graphics code).

The following functions get information from the core client; diff --git a/doc/compound_app.php b/doc/compound_app.php index de21191d70..f15508c36c 100644 --- a/doc/compound_app.php +++ b/doc/compound_app.php @@ -36,7 +36,7 @@ struct BOINC_OPTIONS { int direct_process_action; }; -int boinc_init_options(BOINC_OPTIONS&); +int boinc_init_options(BOINC_OPTIONS*); "; list_start(); @@ -80,7 +80,7 @@ BOINC_OPTIONS options; options.main_program = true; ... -boinc_init_options(options) +boinc_init_options(&options) read main state file for each remaining worker program: aid.fraction_done_start = x @@ -104,7 +104,7 @@ BOINC_OPTIONS options; options.main_program = false; ... -boinc_init_options(options); +boinc_init_options(&options); ... do work, calling boinc_fraction_done() with values from 0 to 1, and boinc_time_to_checkpoint(), occasionally diff --git a/doc/links.php b/doc/links.php index 488e9064dc..ef01ed4543 100644 --- a/doc/links.php +++ b/doc/links.php @@ -108,7 +108,7 @@ language("Finnish", array( )); language("French", array( site("http://boincfrance.org", "BOINCFRANCE.ORG"), - site("http://www.boinc-fr.net", "www.boinc-fr.net"), + site("http://www.boinc-af.org", "L'Alliance Francophone"), site("http://boinc-quebec.org", "boinc-quebec.org") )); language("German", array(