extern "C" int boinc_temporary_exit_wrapper(int delay, const char *reason, int is_notice){ if (is_notice) return boinc_temporary_exit(delay,reason, true); else return boinc_temporary_exit(delay, reason, false); }
int main(int argc, char** argv) { BOINC_OPTIONS boinc_options; BOINC_STATUS boinc_status; char buf[256]; int retval; memset(&boinc_options, 0, sizeof(boinc_options)); boinc_options.main_program = true; boinc_options.check_heartbeat = true; boinc_options.handle_process_control = true; boinc_init_options(&boinc_options); fprintf( stderr, "%s vboxwrapper: starting\n", boinc_msg_prefix(buf, sizeof(buf)) ); retval = parse_job_file(); if (retval) { fprintf( stderr, "%s can't parse job file: %d\n", boinc_msg_prefix(buf, sizeof(buf)), retval ); boinc_finish(retval); } retval = vm.run(); if (retval) { boinc_finish(retval); } while (1) { vm.poll(); boinc_get_status(&boinc_status); if (boinc_status.no_heartbeat || boinc_status.quit_request) { vm.stop(); boinc_temporary_exit(0); } if (boinc_status.abort_request) { vm.cleanup(); boinc_finish(EXIT_ABORTED_BY_CLIENT); } if (!vm.is_running()) { vm.cleanup(); boinc_finish(0); } if (boinc_status.suspended) { if (!vm.suspended) { vm.pause(); } } else { if (vm.suspended) { vm.resume(); } } boinc_sleep(POLL_PERIOD); } return 0; }