From c168971770942e506b0259d39206a301d6b0083f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 14 Mar 2011 17:28:52 +0000 Subject: [PATCH] - API: get rid of BOINC_OPTIONS::backwards_compatible_graphics. Not necessary. - wrapper: add optional element to task descriptor. If set, pass the wrapper's cmdline args to that task. NOTE: previously they were always passed. If you want this behavior, you now must set this. svn path=/trunk/boinc/; revision=23232 --- api/boinc_api.cpp | 8 ++------ api/boinc_api.h | 17 ++++++++++------- checkin_notes | 14 ++++++++++++++ samples/wrapper/wrapper.cpp | 32 +++++++++++++++++--------------- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index 4664b6793f..168cc90477 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -527,9 +527,7 @@ void boinc_exit(int status) { int retval; char buf[256]; - if (options.backwards_compatible_graphics) { - graphics_cleanup(); - } + graphics_cleanup(); if (options.main_program && file_lock.locked) { retval = file_lock.unlock(LOCKFILE); @@ -985,9 +983,7 @@ static void timer_handler() { if (in_critical_section==0 && options.handle_process_control) { handle_process_control_msg(); } - if (options.backwards_compatible_graphics) { - handle_graphics_messages(); - } + handle_graphics_messages(); } if (interrupt_count % TIMERS_PER_SEC) return; diff --git a/api/boinc_api.h b/api/boinc_api.h index c677fa3a0c..d8b9f154c7 100644 --- a/api/boinc_api.h +++ b/api/boinc_api.h @@ -32,28 +32,32 @@ #ifdef __cplusplus extern "C" { #endif + +// parameters passed to the BOINC runtime system +// typedef struct BOINC_OPTIONS { // the following are booleans, implemented as ints for portability - int backwards_compatible_graphics; - // V6 apps should set this so that "Show Graphics" will work - // with pre-V6 clients int normal_thread_priority; - // run app at normal thread priority on Win. + // run worker thread at normal thread priority on Win. // (default is idle priority) int main_program; // this is the main program, so // - lock a lock file in the slot directory // - write finish file on successful boinc_finish() int check_heartbeat; + // check for timeout of heartbeats from the client; // action is determined by direct_process_action (see below) int handle_trickle_ups; - // this process is allowed to call boinc_send_trickle_up() + // periodically check for trickle-up msgs from the app + // must set this to use boinc_send_trickle_up() int handle_trickle_downs; // this process is allowed to call boinc_receive_trickle_down() int handle_process_control; + // whether runtime system should read suspend/resume/quit/abort + // msgs from client. // action is determined by direct_process_action (see below) int send_status_msgs; - // send CPU time / fraction done msgs + // whether runtime system should send CPU time / fraction done msgs int direct_process_action; // if heartbeat fail, or get process control msg, take // direction action (exit, suspend, resume). @@ -148,7 +152,6 @@ inline void boinc_options_defaults(BOINC_OPTIONS& b) { b.handle_process_control = 1; b.send_status_msgs = 1; b.direct_process_action = 1; - b.backwards_compatible_graphics = 1; b.normal_thread_priority = 0; } diff --git a/checkin_notes b/checkin_notes index b886831574..e2308588bd 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1613,3 +1613,17 @@ David 13 Mar 2011 cpu_sched.cpp sched/ validator.cpp + +David 14 Mar 2011 + - API: get rid of BOINC_OPTIONS::backwards_compatible_graphics. + Not necessary. + - wrapper: add optional element to + task descriptor. + If set, pass the wrapper's cmdline args to that task. + NOTE: previously they were always passed. + If you want this behavior, you now must set this. + + samples/wrapper/ + wrapper.cpp + api/ + boinc_api.cpp,h diff --git a/samples/wrapper/wrapper.cpp b/samples/wrapper/wrapper.cpp index 9818ec8d34..942b74c9b7 100644 --- a/samples/wrapper/wrapper.cpp +++ b/samples/wrapper/wrapper.cpp @@ -75,6 +75,7 @@ struct TASK { double weight; // contribution of this task to overall fraction done bool is_daemon; + bool append_cmdline_args; // dynamic stuff follows double final_cpu_time; @@ -169,7 +170,6 @@ struct TASK { vector tasks; vector daemons; APP_INIT_DATA aid; -bool graphics = false; // macro replacement in wrapper strings from job.xml // for example PROJECT_DIR can be replaced in exec_dir and environment variables @@ -199,6 +199,7 @@ int TASK::parse(XML_PARSER& xp) { stat_first = true; pid = 0; is_daemon = false; + append_cmdline_args = false; while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) { @@ -233,6 +234,7 @@ int TASK::parse(XML_PARSER& xp) { else if (xp.parse_string(tag, "fraction_done_filename", fraction_done_filename)) continue; else if (xp.parse_double(tag, "weight", weight)) continue; else if (xp.parse_bool(tag, "daemon", is_daemon)) continue; + else if (xp.parse_bool(tag, "append_cmdline_args", append_cmdline_args)) continue; } return ERR_XML_PARSE; } @@ -258,7 +260,7 @@ int parse_job_file() { while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) { fprintf(stderr, - "%s SCHED_CONFIG::parse(): unexpected text %s\n", + "%s unexpected text in job.xml: %s\n", boinc_msg_prefix(buf2, sizeof(buf2)), tag ); continue; @@ -277,6 +279,12 @@ int parse_job_file() { tasks.push_back(task); } } + continue; + } else { + fprintf(stderr, + "%s unexpected tag in job.xml: %s\n", + boinc_msg_prefix(buf2, sizeof(buf2)), tag + ); } } fclose(f); @@ -376,11 +384,14 @@ int TASK::run(int argct, char** argvt) { boinc_resolve_filename(buf, app_path, sizeof(app_path)); } - // Append wrapper's command-line arguments to those in the job file. + // Optionally append wrapper's command-line arguments + // to those in the job file. // - for (int i=1; i