mirror of https://github.com/BOINC/boinc.git
- client (Win) add some bulletproofing in case Windows sends us a
"suspending" event but not a resume event. svn path=/trunk/boinc/; revision=23786
This commit is contained in:
parent
2177a6bd95
commit
ce215299e6
|
@ -3844,3 +3844,11 @@ David 29 Jun 2011
|
|||
client/
|
||||
client_state.h
|
||||
sysmon_win.cpp
|
||||
|
||||
David 30 Jun 2011
|
||||
- client (Win) add some bulletproofing in case Windows sends us a
|
||||
"suspending" event but not a resume event.
|
||||
|
||||
client/
|
||||
client_state.cpp,h
|
||||
sysmon_win.cpp
|
||||
|
|
|
@ -108,6 +108,7 @@ CLIENT_STATE::CLIENT_STATE()
|
|||
started_by_screensaver = false;
|
||||
requested_exit = false;
|
||||
os_requested_suspend = false;
|
||||
os_requested_suspend_time = 0;
|
||||
cleanup_completed = false;
|
||||
in_abort_sequence = false;
|
||||
master_fetch_period = MASTER_FETCH_PERIOD;
|
||||
|
@ -264,6 +265,32 @@ double calculate_exponential_backoff(int n, double MIN, double MAX) {
|
|||
|
||||
#ifndef SIM
|
||||
|
||||
void CLIENT_STATE::set_now() {
|
||||
double x = dtime();
|
||||
|
||||
// if time went backward significantly, clear delays
|
||||
//
|
||||
if (x < (now-60)) {
|
||||
clear_absolute_times();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// On Win, check for evidence that we're awake after a suspension
|
||||
// (in case we missed the event announcing this)
|
||||
//
|
||||
if (os_requested_suspend) {
|
||||
if (x > now+10) {
|
||||
msg_printf(0, MSG_NORMAL, "Resuming after OS suspension");
|
||||
os_requested_suspend = false;
|
||||
} else if (x > os_requested_suspend_time + 300) {
|
||||
msg_printf(0, MSG_NORMAL, "Resuming after OS suspension");
|
||||
os_requested_suspend = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
now = x;
|
||||
}
|
||||
|
||||
int CLIENT_STATE::init() {
|
||||
int retval;
|
||||
unsigned int i;
|
||||
|
|
|
@ -121,6 +121,7 @@ struct CLIENT_STATE {
|
|||
// we should suspend for OS reasonts (used on Win only).
|
||||
// Set when
|
||||
// - got BATTERY_LOW, SUSPEND, SERVICE_CONTROL_PAUSE
|
||||
double os_requested_suspend_time;
|
||||
bool cleanup_completed;
|
||||
bool in_abort_sequence;
|
||||
// Determine when it is safe to leave the quit_client() handler
|
||||
|
@ -262,15 +263,7 @@ struct CLIENT_STATE {
|
|||
int nresults_for_project(PROJECT*);
|
||||
void check_clock_reset();
|
||||
void clear_absolute_times();
|
||||
inline void set_now() {
|
||||
double x = dtime();
|
||||
if (x < (now-60)) {
|
||||
// if time went backward significantly, clear delays
|
||||
//
|
||||
clear_absolute_times();
|
||||
}
|
||||
now = x;
|
||||
}
|
||||
void set_now();
|
||||
|
||||
// --------------- cpu_sched.cpp:
|
||||
double total_resource_share();
|
||||
|
|
|
@ -59,6 +59,7 @@ static void quit_client() {
|
|||
// Suspend client operations
|
||||
static void suspend_client() {
|
||||
gstate.os_requested_suspend = true;
|
||||
gstate.os_requested_suspend_time = dtime();
|
||||
}
|
||||
|
||||
// Resume client operations
|
||||
|
|
Loading…
Reference in New Issue