mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5232
This commit is contained in:
parent
e342603db0
commit
7c0456340a
|
@ -99,6 +99,7 @@ static int nrunning_ticks = 0;
|
|||
//HANDLE hResumeRequest;
|
||||
static HANDLE hSharedMem;
|
||||
HANDLE worker_thread_handle;
|
||||
// used to suspend worker thread, and to measure its CPU time
|
||||
static MMRESULT timer_id;
|
||||
#endif
|
||||
|
||||
|
@ -111,14 +112,6 @@ static BOINC_STATUS boinc_status;
|
|||
//
|
||||
int boinc_init() {
|
||||
boinc_options_defaults(options);
|
||||
|
||||
// adjust the thread priority so we don't eat cycles from
|
||||
// other programs
|
||||
//
|
||||
#ifdef _WIN32
|
||||
boinc_adjust_worker_thread_priority(GetCurrentThread());
|
||||
#endif
|
||||
|
||||
return boinc_init_options(options);
|
||||
}
|
||||
|
||||
|
@ -153,18 +146,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;
|
||||
|
@ -201,20 +182,6 @@ int boinc_init_options_general(BOINC_OPTIONS& opt) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// adjust the worker thread priority to the lowest thread priority
|
||||
// available
|
||||
#ifdef _WIN32
|
||||
int boinc_adjust_worker_thread_priority(HANDLE thread_handle) {
|
||||
if (!SetThreadPriority(thread_handle, THREAD_PRIORITY_LOWEST))
|
||||
return ERR_THREAD;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int boinc_adjust_worker_thread_priority(pthread_t thread_handle) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int boinc_get_status(BOINC_STATUS& s) {
|
||||
s = boinc_status;
|
||||
return 0;
|
||||
|
@ -563,9 +530,22 @@ static void worker_timer(int a) {
|
|||
}
|
||||
|
||||
|
||||
// set up a periodic timer interrupt for the worker thread.
|
||||
// This is called only and always by the worker thread
|
||||
//
|
||||
int set_worker_timer() {
|
||||
int retval=0;
|
||||
|
||||
#ifdef _WIN32
|
||||
DuplicateHandle(
|
||||
GetCurrentProcess(),
|
||||
GetCurrentThread(),
|
||||
GetCurrentProcess(),
|
||||
&worker_thread_handle,
|
||||
0,
|
||||
FALSE,
|
||||
DUPLICATE_SAME_ACCESS
|
||||
);
|
||||
|
||||
// Use Windows multimedia timer, since it is more accurate
|
||||
// than SetTimer and doesn't require an associated event loop
|
||||
|
@ -577,6 +557,10 @@ int set_worker_timer() {
|
|||
NULL, // dwUser
|
||||
TIME_PERIODIC // fuEvent
|
||||
);
|
||||
|
||||
// lower our priority here
|
||||
//
|
||||
SetThreadPriority(worker_thread_handle, THREAD_PRIORITY_LOWEST);
|
||||
#else
|
||||
struct sigaction sa;
|
||||
itimerval value;
|
||||
|
|
|
@ -97,11 +97,6 @@ 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&);
|
||||
#ifdef _WIN32
|
||||
extern int boinc_adjust_worker_thread_priority(HANDLE thread_handle);
|
||||
#else
|
||||
extern int boinc_adjust_worker_thread_priority(pthread_t thread_handle);
|
||||
#endif
|
||||
|
||||
/////////// API ENDS HERE
|
||||
|
||||
|
|
|
@ -59,23 +59,21 @@ extern "C" {
|
|||
*result = boinc_is_standalone();
|
||||
}
|
||||
|
||||
void boinc_resolve_filename_(const char* s, char* t, int* length, int s_len, int t_len)
|
||||
{
|
||||
void boinc_resolve_filename_(
|
||||
const char* s, char* t, int* length, int s_len, int t_len
|
||||
) {
|
||||
boinc_resolve_filename(StringFromFortran(s, s_len), t, *length);
|
||||
}
|
||||
|
||||
void boincrf_(const char* s, char* t, int s_len, int t_len)
|
||||
{
|
||||
void boincrf_(const char* s, char* t, int s_len, int t_len) {
|
||||
boinc_resolve_filename(StringFromFortran(s, s_len), t, t_len);
|
||||
}
|
||||
|
||||
void boinc_parse_init_data_file_()
|
||||
{
|
||||
void boinc_parse_init_data_file_() {
|
||||
boinc_parse_init_data_file();
|
||||
}
|
||||
|
||||
void boinc_write_init_data_file_()
|
||||
{
|
||||
void boinc_write_init_data_file_() {
|
||||
boinc_write_init_data_file_();
|
||||
}
|
||||
|
||||
|
@ -108,15 +106,10 @@ extern "C" {
|
|||
boinc_wu_cpu_time(*d_out);
|
||||
}
|
||||
|
||||
void boinc_calling_thread_cpu_time_(double* d1_out, double* d2_out)
|
||||
{
|
||||
void boinc_calling_thread_cpu_time_(double* d1_out, double* d2_out) {
|
||||
boinc_calling_thread_cpu_time(*d1_out, *d2_out);
|
||||
}
|
||||
|
||||
void boinc_sixtrack_progress_(int* n,int* total)
|
||||
{
|
||||
boinc_fraction_done(*n / *total);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -100,19 +100,11 @@ int start_worker_thread(WORKER_FUNC_PTR _worker_main) {
|
|||
|
||||
DWORD threadId;
|
||||
|
||||
// Create the graphics thread, passing it the graphics info
|
||||
// TODO: is it better to use _beginthreadex here?
|
||||
// Create and start worker thread
|
||||
//
|
||||
worker_thread_handle = CreateThread(
|
||||
NULL, 0, foobar, 0, CREATE_SUSPENDED, &threadId
|
||||
);
|
||||
|
||||
// lower worker thread priority
|
||||
//
|
||||
boinc_adjust_worker_thread_priority(worker_thread_handle);
|
||||
|
||||
// Start the worker thread
|
||||
//
|
||||
ResumeThread(worker_thread_handle);
|
||||
|
||||
#else
|
||||
|
|
|
@ -23342,3 +23342,16 @@ David 27 Jan 2005
|
|||
tools/
|
||||
kill_wu.C
|
||||
poll_wu.C
|
||||
|
||||
David 27 Jan 2005
|
||||
- API: move code to get worker thread handle,
|
||||
and set its priority, to set_worker_timer().
|
||||
This function is guaranteed to be always called
|
||||
by the worker thread, and only by the worker thread.
|
||||
Got rid of boinc_adjust_worker_thread_priority().
|
||||
- removed LHC@home-specific function from boinc_api_fortran.C
|
||||
|
||||
api/
|
||||
boinc_api.C
|
||||
boinc_api_fortran.C
|
||||
graphics_impl.C
|
||||
|
|
Loading…
Reference in New Issue