mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5218
This commit is contained in:
parent
298751444d
commit
943dfda580
|
@ -107,6 +107,28 @@ static BOINC_STATUS boinc_status;
|
|||
//
|
||||
int boinc_init() {
|
||||
boinc_options_defaults(options);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// populate the global thread handle before adjusting the priority
|
||||
// of the thread
|
||||
//
|
||||
DuplicateHandle(
|
||||
GetCurrentProcess(),
|
||||
GetCurrentThread(),
|
||||
GetCurrentProcess(),
|
||||
&worker_thread_handle,
|
||||
0,
|
||||
FALSE,
|
||||
DUPLICATE_SAME_ACCESS
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
// adjust the thread priority so we don't eat cycles from
|
||||
// other programs
|
||||
boinc_adjust_worker_thread_priority();
|
||||
|
||||
return boinc_init_options(options);
|
||||
}
|
||||
|
||||
|
@ -141,18 +163,6 @@ int boinc_init_options_general(BOINC_OPTIONS& opt) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
DuplicateHandle(
|
||||
GetCurrentProcess(),
|
||||
GetCurrentThread(),
|
||||
GetCurrentProcess(),
|
||||
&worker_thread_handle,
|
||||
0,
|
||||
FALSE,
|
||||
DUPLICATE_SAME_ACCESS
|
||||
);
|
||||
#endif
|
||||
|
||||
retval = boinc_parse_init_data_file();
|
||||
if (retval) {
|
||||
standalone = true;
|
||||
|
@ -189,6 +199,20 @@ int boinc_init_options_general(BOINC_OPTIONS& opt) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// adjust the worker thread priority to the lowest thread priority
|
||||
// available
|
||||
int boinc_adjust_worker_thread_priority() {
|
||||
#ifdef _WIN32
|
||||
|
||||
// lower worker thread priority
|
||||
//
|
||||
if (!SetThreadPriority(worker_thread_handle, THREAD_PRIORITY_LOWEST))
|
||||
return ERR_THREAD;
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int boinc_get_status(BOINC_STATUS& s) {
|
||||
s = boinc_status;
|
||||
return 0;
|
||||
|
|
|
@ -97,6 +97,7 @@ extern int boinc_get_status(BOINC_STATUS&);
|
|||
extern int boinc_resolve_filename_s(const char*, std::string&);
|
||||
extern int boinc_get_init_data(APP_INIT_DATA&);
|
||||
extern int boinc_wu_cpu_time(double&);
|
||||
extern int boinc_adjust_worker_thread_priority();
|
||||
|
||||
/////////// API ENDS HERE
|
||||
|
||||
|
|
|
@ -107,14 +107,9 @@ int start_worker_thread(WORKER_FUNC_PTR _worker_main) {
|
|||
NULL, 0, foobar, 0, CREATE_SUSPENDED, &threadId
|
||||
);
|
||||
|
||||
// raise priority of graphics thread (i.e. current thread)
|
||||
//
|
||||
HANDLE h = GetCurrentThread();
|
||||
SetThreadPriority(h, THREAD_PRIORITY_HIGHEST);
|
||||
|
||||
// lower worker thread priority
|
||||
//
|
||||
SetThreadPriority(worker_thread_handle, THREAD_PRIORITY_LOWEST);
|
||||
boinc_adjust_worker_thread_priority();
|
||||
|
||||
// Start the worker thread
|
||||
//
|
||||
|
|
|
@ -23277,3 +23277,16 @@ David 26 Jan 2005
|
|||
- Reinhard's patch to configure.ac
|
||||
|
||||
configure.ac
|
||||
|
||||
Rom 26 Jan 2005
|
||||
- The worker thread for a science application should be lowered for both
|
||||
the graphics capable application and non-graphics capable.
|
||||
- The graphics thread should now be set to a normal thread priority level
|
||||
instead of high.
|
||||
|
||||
NOTE: The above changes were only implemented for Windows right now,
|
||||
the pthread version of this stuff needs to be done.
|
||||
|
||||
api/
|
||||
boinc_api.C, .h
|
||||
graphics_impl.C
|
||||
|
|
Loading…
Reference in New Issue