*** empty log message ***

svn path=/trunk/boinc/; revision=9725
This commit is contained in:
Walt Gribben 2006-03-24 22:46:46 +00:00
parent 6cd6c9e130
commit 17e818b8bd
3 changed files with 39 additions and 32 deletions

View File

@ -3207,3 +3207,14 @@ Rom 23 Mar 2006
tools/
make_project
Walt 23 Mar 2006
- Bug Fix: Multiple load/unloads of boinc.dll messed up the
idle detection routine. Removed redundant load/free module
code so dll is loaded once in beginning, unloaded at program
end.
client
main.C
client/win
hostinfo_win.C

View File

@ -298,7 +298,6 @@ int check_unique_instance() {
// of the core client can run at a time
//
BOOL bIsWin2k = FALSE;
g_hClientLibraryDll = LoadLibrary("boinc.dll");
char buf[MAX_PATH] = "";
if (g_hClientLibraryDll) {
@ -307,9 +306,7 @@ int check_unique_instance() {
if (fn) {
bIsWin2k = fn();
}
FreeLibrary(g_hClientLibraryDll);
g_hClientLibraryDll = NULL;
}
}
// Global mutex on Win2k and later
//
@ -331,8 +328,6 @@ int check_unique_instance() {
}
static void init_core_client(int argc, char** argv) {
int retval;
setbuf(stdout, 0);
setbuf(stderr, 0);
@ -380,11 +375,6 @@ static void init_core_client(int argc, char** argv) {
"stderrdae"
);
retval = check_unique_instance();
if (retval) {
msg_printf(NULL, MSG_INFO, "Another instance of BOINC is running");
exit(1);
}
// Win32 - detach from console if requested
#ifdef _WIN32
@ -545,6 +535,24 @@ int main(int argc, char** argv) {
curl_init();
#ifdef _WIN32
g_hClientLibraryDll = LoadLibrary("boinc.dll");
if(!g_hClientLibraryDll) {
char errmsg[256];
DWORD errcode = GetLastError();
printf(
"BOINC Core Client Error Message\n"
"Failed to initialize the BOINC Idle Detection Interface\n"
"BOINC will not be able to determine if the user is idle or not...\n"
"Load failed: %s\n", windows_error_string( errmsg, sizeof(errmsg))
);
}
retval = check_unique_instance();
if (retval) {
msg_printf(NULL, MSG_INFO, "Another instance of BOINC is running");
exit(1);
}
// Figure out if we're on Win9x
OSVERSIONINFO osvi;
@ -583,25 +591,15 @@ int main(int argc, char** argv) {
}
#endif
g_hClientLibraryDll = LoadLibrary("boinc.dll");
if(!g_hClientLibraryDll) {
printf(
"BOINC Core Client Error Message\n"
"Failed to initialize the BOINC Idle Detection Interface\n"
"BOINC will not be able to determine if the user is idle or not...\n"
);
}
if(g_hClientLibraryDll) {
ClientLibraryStartup fnClientLibraryStartup;
fnClientLibraryStartup = (ClientLibraryStartup)GetProcAddress(g_hClientLibraryDll, _T("ClientLibraryStartup"));
if(!fnClientLibraryStartup) {
FreeLibrary(g_hClientLibraryDll);
g_hClientLibraryDll = NULL;
} else {
if(fnClientLibraryStartup) {
if(!fnClientLibraryStartup()) {
FreeLibrary(g_hClientLibraryDll);
g_hClientLibraryDll = NULL;
printf(
"BOINC Core Client Error Message\n"
"Failed to initialize Client Library interface\n"
);
}
}
}

View File

@ -428,12 +428,10 @@ bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) {
typedef DWORD (CALLBACK* GetFn)();
static GetFn fn = (GetFn)GetProcAddress(g_hClientLibraryDll, "BOINCGetIdleTickCount");
if (g_hClientLibraryDll) {
if (fn) {
double seconds_idle = fn() / 1000;
double seconds_time_to_run = 60 * idle_time_to_run;
return seconds_idle > seconds_time_to_run;
}
if (g_hClientLibraryDll && fn) {
double seconds_idle = fn() / 1000;
double seconds_time_to_run = 60 * idle_time_to_run;
return seconds_idle > seconds_time_to_run;
}
return false;