mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3521
This commit is contained in:
parent
319b4573b7
commit
a037306f2a
|
@ -328,7 +328,9 @@ int CLIENT_STATE::net_sleep(double x) {
|
|||
bool CLIENT_STATE::do_something() {
|
||||
int actions = 0, reason, retval;
|
||||
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_POLL);
|
||||
|
||||
#ifndef _WIN32
|
||||
check_idle();
|
||||
#endif
|
||||
check_suspend_activities(reason);
|
||||
if (reason) {
|
||||
if (!activities_suspended) {
|
||||
|
|
|
@ -230,6 +230,9 @@ private:
|
|||
int resume_network();
|
||||
void install_global_prefs();
|
||||
void show_global_prefs_source(bool);
|
||||
#ifndef _WIN32
|
||||
void check_idle();
|
||||
#endif
|
||||
|
||||
// --------------- cs_scheduler.C:
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,15 @@
|
|||
#include "stdafx.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#if HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
#include "filesys.h"
|
||||
#include "file_names.h"
|
||||
|
@ -92,6 +101,22 @@ inline bool now_between_two_hours(int start_hour, int end_hour) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// returns true iff device was last accessed before t
|
||||
// or if an error occurred looking at the device.
|
||||
inline bool device_idle(time_t t, char *device) {
|
||||
struct stat sbuf;
|
||||
return stat(device, &sbuf) || (sbuf.st_atime < t);
|
||||
}
|
||||
|
||||
void CLIENT_STATE::check_idle() {
|
||||
time_t idle_time =
|
||||
time(NULL) - (long) (60 * global_prefs.idle_time_to_run);
|
||||
user_idle = device_idle(idle_time, "/dev/kbd")
|
||||
&& device_idle(idle_time, "/dev/mouse");
|
||||
}
|
||||
#endif
|
||||
|
||||
// See if (on the basis of user run request and prefs)
|
||||
// we should suspend activities.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue