diff --git a/api/boinc_api.C b/api/boinc_api.C index fe4e48086c..e0b552af55 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -469,7 +469,10 @@ void boinc_exit(int status) { // stops endless exit()/atexit() loops. _exit(status); #else - // POSIX exit call. + // arrange to exit with given status even if errors happen + // in atexit() functions + // + set_signal_exit_code(status); exit(status); #endif } diff --git a/checkin_notes b/checkin_notes index 05474d284f..9a7f10bd85 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5081,3 +5081,14 @@ Rom 23 June 2008 BOINCTaskBar.cpp clientgui/msw/ taskbarex.cpp, .h + +David 23 June 2008 + - API, Unix: when boinc_finish(x) is called, exit with code x + even if signals happen in the atexit() handling + - API: don't print XML parse warnings for init_data.xml file + + api/ + boinc_api.C + lib/ + app_ipc.C + diagnostics.C,h diff --git a/html/inc/bolt_util.inc b/html/inc/bolt_util.inc index 3a19e3be6f..2f3a23ef94 100644 --- a/html/inc/bolt_util.inc +++ b/html/inc/bolt_util.inc @@ -53,6 +53,10 @@ function request_info($user, $course) { page_tail(); } +function compare_snapshot_filename($course_id, $select_name, $xset_name) { + return "../bolt_snap/compare_snapshot_".$course_id."_".$select_name."_".$xset_name.".json"; +} + ////// stuff related to snapshots // a "snapshot" is a condensed representation of the results @@ -62,7 +66,9 @@ function request_info($user, $course) { // xset_result: the user's first completion of the xset // select_finished: the user's last completion of the select before this -function write_compare_snapshot($course_id, $select_name, $xset_name, $start) { +function write_compare_snapshot($course_id, $select_name, $xset_name, $dur) { + $now = time(); + $start = $now - $dur*86400; $xrs = BoltXsetResult::enum( "course_id=$course_id and name='$xset_name' and create_time >= $start" ); @@ -96,15 +102,20 @@ function write_compare_snapshot($course_id, $select_name, $xset_name, $start) { $a[$uid] = $x; } } - $filename = "compare_snapshot_$course_id_$select_name_$xset_name.json"; + $filename = compare_snapshot_filename($course_id, $select_name, $xset_name); $f = fopen($filename, "w"); - fwrite($f, json_encode($a)); + + $s = null; + $s->recs = $a; + $s->dur = $dur; + $s->time = $now; + fwrite($f, json_encode($s)); fclose($f); - return $a; + return $s; } function read_compare_snapshot($course_id, $select_name, $xset_name) { - $filename = "compare_snapshot_".$course_id."_".$select_name."_".$xset_name.".json"; + $filename = compare_snapshot_filename($course_id, $select_name, $xset_name); $f = @fopen($filename, "r"); if (!$f) return null; $x = fread($f, filesize($filename)); diff --git a/html/user/bolt_compare.php b/html/user/bolt_compare.php index dc63067d5c..74b4295bfb 100644 --- a/html/user/bolt_compare.php +++ b/html/user/bolt_compare.php @@ -68,10 +68,11 @@ function choose_xset($top_unit) { } function compare_aux($snap) { + print_r($snap); // for each select alternative, build an array of xset scores // $a = array(); - foreach ($snap as $x) { + foreach ($snap->recs as $uid=>$x) { //$a[$x->select_finished_name][] = $x->xset_result->score; } @@ -93,20 +94,25 @@ function show_snap_form($top_unit) { $xset_name = get_str('xset_name'); page_head("Data snapshot"); $s = read_compare_snapshot($course_id, $select_name, $xset_name); + if ($s) { - $end = date_str($s->end); + $end = date_str($s->time); echo " - A data snapshot exists for the $$s->dur days prior to $end. + A data snapshot exists for the $s->dur days prior to $end. "; button( "bolt_compare.php?action=compare&course_id=$course_id", "Use this snapshot" ); + } else { + echo "There is currently no snapshot."; } echo "