*** empty log message ***

svn path=/trunk/boinc/; revision=1175
This commit is contained in:
Eric Heien 2003-05-09 20:33:57 +00:00
parent 39e4895b2d
commit 3728935309
12 changed files with 87 additions and 85 deletions

View File

@ -94,10 +94,10 @@ ACTIVE_TASK::ACTIVE_TASK() {
exit_status = 0;
signal = 0;
strcpy(slot_dir, "");
graphics_requested_mode = MODE_HIDE_GRAPHICS;
graphics_request_time = time(0);
graphics_acked_mode = MODE_UNSUPPORTED;
graphics_mode_before_ss = MODE_HIDE_GRAPHICS;
graphics_requested_mode = MODE_HIDE_GRAPHICS;
graphics_request_time = time(0);
graphics_acked_mode = MODE_UNSUPPORTED;
graphics_mode_before_ss = MODE_HIDE_GRAPHICS;
}
int ACTIVE_TASK::init(RESULT* rp) {
@ -169,8 +169,8 @@ int ACTIVE_TASK::start(bool first_time) {
return ERR_FOPEN;
}
// make a unique key for core/app shared memory segment
//
// make a unique key for core/app shared memory segment
//
#ifdef _WIN32
sprintf(aid.comm_obj_name, "boinc_%d", slot);
#else
@ -304,13 +304,13 @@ int ACTIVE_TASK::start(bool first_time) {
sprintf(buf, "%s%s", QUIT_PREFIX, aid.comm_obj_name);
quitRequestEvent = CreateEvent(0, TRUE, FALSE, buf);
// create core/app share mem segment
//
// create core/app share mem segment
//
sprintf(buf, "%s%s", SHM_PREFIX, aid.comm_obj_name);
shm_handle = create_shmem(buf, APP_CLIENT_SHMEM_SIZE,
(void **)&app_client_shm.shm
);
app_client_shm.reset_msgs();
(void **)&app_client_shm.shm
);
app_client_shm.reset_msgs();
// NOTE: in Windows, stderr is redirected within boinc_init();
@ -607,18 +607,18 @@ bool ACTIVE_TASK::read_stderr_file() {
}
void ACTIVE_TASK::request_graphics_mode(int mode) {
app_client_shm.send_graphics_mode_msg(CORE_APP_GFX_SEG, mode);
graphics_requested_mode = mode;
app_client_shm.send_graphics_mode_msg(CORE_APP_GFX_SEG, mode);
graphics_requested_mode = mode;
}
void ACTIVE_TASK::check_graphics_mode_ack() {
int mode;
if (app_client_shm.get_graphics_mode_msg(APP_CORE_GFX_SEG, mode)) {
graphics_acked_mode = mode;
if (mode != MODE_FULLSCREEN) {
graphics_mode_before_ss = mode;
}
}
int mode;
if (app_client_shm.get_graphics_mode_msg(APP_CORE_GFX_SEG, mode)) {
graphics_acked_mode = mode;
if (mode != MODE_FULLSCREEN) {
graphics_mode_before_ss = mode;
}
}
}
// Wait up to wait_time seconds for all processes in this set to exit
@ -831,7 +831,7 @@ int ACTIVE_TASK::get_cpu_time() {
// If so read it and return true.
//
bool ACTIVE_TASK::check_app_status() {
char msg_buf[SHM_SEG_SIZE];
char msg_buf[SHM_SEG_SIZE];
if (app_client_shm.get_msg(msg_buf, APP_CORE_WORKER_SEG)) {
fraction_done = current_cpu_time = checkpoint_cpu_time = 0.0;
parse_double(msg_buf, "<fraction_done>", fraction_done);
@ -1099,6 +1099,6 @@ void ACTIVE_TASK_SET::check_graphics_mode_ack() {
for (i=0; i<active_tasks.size(); i++) {
atp = active_tasks[i];
atp->check_graphics_mode_ack();
}
atp->check_graphics_mode_ack();
}
}

View File

@ -90,8 +90,8 @@ public:
int graphics_request_time; // when we sent it
int graphics_acked_mode; // most recent mode reported by app
int graphics_mode_before_ss; // mode before last screensaver request
void request_graphics_mode(int);
void check_graphics_mode_ack();
void request_graphics_mode(int);
void check_graphics_mode_ack();
ACTIVE_TASK();
int init(RESULT*);
@ -143,7 +143,7 @@ public:
void save_app_modes();
void hide_apps();
void restore_apps();
void check_graphics_mode_ack();
void check_graphics_mode_ack();
int write(FILE*);
int parse(FILE*, CLIENT_STATE*);

View File

@ -201,6 +201,8 @@ int CLIENT_STATE::init() {
print_summary();
}
show_message(NULL, "Starting BOINC client", MSG_INFO);
// Read the global preferences file, if it exists.
// Do this after reading the state file so we know our venue
//

View File

@ -58,7 +58,7 @@ public:
HOST_INFO host_info;
GLOBAL_PREFS global_prefs;
NET_STATS net_stats;
SS_LOGIC ss_logic;
SS_LOGIC ss_logic;
CLIENT_STATE();
int init();

View File

@ -244,10 +244,10 @@ void PROJECT::copy_state_fields(PROJECT& p) {
}
char *PROJECT::get_project_name() {
if(!strcmp(project_name, ""))
return master_url;
else
return project_name;
if(!strcmp(project_name, ""))
return master_url;
else
return project_name;
}
int APP::parse(FILE* in) {

View File

@ -60,6 +60,7 @@ int CLIENT_STATE::cleanup_and_exit() {
fprintf(stderr, "error: CLIENT_STATE.exit: write_state_file failed\n");
// don't return here - we'll exit anyway
}
show_message(NULL, "Exiting BOINC client", MSG_INFO);
return 0;
}

View File

@ -177,7 +177,7 @@ void SCHEDULER_OP::backoff(PROJECT* p, char *error_msg ) {
int SCHEDULER_OP::start_rpc() {
FILE *f;
int retval;
char msg_buf[256];
char msg_buf[256];
safe_strcpy(scheduler_url, project->scheduler_urls[url_index].text);
if (log_flags.sched_ops) {

View File

@ -36,7 +36,7 @@ void SS_LOGIC::start_ss(time_t new_blank_time) {
}
void SS_LOGIC::stop_ss() {
if (!do_ss) return;
if (!do_ss) return;
do_ss = do_boinc_logo_ss = do_blank = false;
delete_curtain();
gstate.active_tasks.restore_apps();
@ -48,7 +48,7 @@ void SS_LOGIC::stop_ss() {
void SS_LOGIC::poll() {
ACTIVE_TASK* atp;
gstate.active_tasks.check_graphics_mode_ack();
gstate.active_tasks.check_graphics_mode_ack();
if (do_ss) {
if (blank_time && (time(0) > blank_time)) {
@ -64,11 +64,11 @@ void SS_LOGIC::poll() {
atp = gstate.active_tasks.get_app_requested(MODE_FULLSCREEN);
if (atp) {
if (atp->graphics_acked_mode == MODE_FULLSCREEN) {
do_boinc_logo_ss = false;
} else {
do_boinc_logo_ss = false;
} else {
if (time(0)>ack_deadline) {
do_boinc_logo_ss = true;
}
do_boinc_logo_ss = true;
}
}
} else {
atp = gstate.active_tasks.get_graphics_capable_app();

View File

@ -6,11 +6,11 @@
#include "app_ipc.h"
char* xml_graphics_modes[5] = {
"<mode_unsupported/>",
"<mode_hide_graphics/>",
"<mode_window/>",
"<mode_fullscreen/>",
"<mode_blankscreen/>"
"<mode_unsupported/>",
"<mode_hide_graphics/>",
"<mode_window/>",
"<mode_fullscreen/>",
"<mode_blankscreen/>"
};
int write_init_data_file(FILE* f, APP_INIT_DATA& ai) {
@ -115,70 +115,70 @@ int parse_fd_init_file(FILE* f) {
}
bool APP_CLIENT_SHM::pending_msg(int seg_num) {
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
return (shm[seg_num*SHM_SEG_SIZE]?true:false);
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
return (shm[seg_num*SHM_SEG_SIZE]?true:false);
}
bool APP_CLIENT_SHM::get_msg(char *msg, int seg_num) {
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
// Check if there's an available message
// Check if there's an available message
//
if (!shm[seg_num*SHM_SEG_SIZE]) return false;
if (!shm[seg_num*SHM_SEG_SIZE]) return false;
// Copy the message from shared memory
// Copy the message from shared memory
//
strncpy(msg, &shm[(seg_num*SHM_SEG_SIZE)+1], SHM_SEG_SIZE-1);
strncpy(msg, &shm[(seg_num*SHM_SEG_SIZE)+1], SHM_SEG_SIZE-1);
// Reset the message status flag
// Reset the message status flag
//
shm[seg_num*SHM_SEG_SIZE] = 0;
return true;
shm[seg_num*SHM_SEG_SIZE] = 0;
return true;
}
bool APP_CLIENT_SHM::send_msg(char *msg,int seg_num) {
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false;
// Check if there's already a message
// Check if there's already a message
//
//if (shm[seg_num*SHM_SEG_SIZE]) return false;
//if (shm[seg_num*SHM_SEG_SIZE]) return false;
// Copy the message into shared memory
// Copy the message into shared memory
//
strncpy(&shm[(seg_num*SHM_SEG_SIZE)+1], msg, SHM_SEG_SIZE-1);
strncpy(&shm[(seg_num*SHM_SEG_SIZE)+1], msg, SHM_SEG_SIZE-1);
// Set the message status flag
// Set the message status flag
//
shm[seg_num*SHM_SEG_SIZE] = 1;
return true;
shm[seg_num*SHM_SEG_SIZE] = 1;
return true;
}
void APP_CLIENT_SHM::reset_msgs(void) {
if (shm == NULL) return;
memset(shm, 0, sizeof(char)*NUM_SEGS*SHM_SEG_SIZE);
if (shm == NULL) return;
memset(shm, 0, sizeof(char)*NUM_SEGS*SHM_SEG_SIZE);
}
void APP_CLIENT_SHM::reset_msg(int seg_num) {
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return;
memset(&shm[seg_num*SHM_SEG_SIZE], 0, sizeof(char)*SHM_SEG_SIZE);
if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return;
memset(&shm[seg_num*SHM_SEG_SIZE], 0, sizeof(char)*SHM_SEG_SIZE);
}
bool APP_CLIENT_SHM::send_graphics_mode_msg(int seg, int mode) {
return send_msg(xml_graphics_modes[mode], seg);
return send_msg(xml_graphics_modes[mode], seg);
}
bool APP_CLIENT_SHM::get_graphics_mode_msg(int seg, int& mode) {
char buf[SHM_SEG_SIZE];
int i;
char buf[SHM_SEG_SIZE];
int i;
if (!get_msg(buf, seg)) return false;
for (i=0; i<5; i++) {
if (match_tag(buf, xml_graphics_modes[i])) {
mode = i;
return true;
}
}
return false;
if (!get_msg(buf, seg)) return false;
for (i=0; i<5; i++) {
if (match_tag(buf, xml_graphics_modes[i])) {
mode = i;
return true;
}
}
return false;
}
int write_graphics_file(FILE* f, GRAPHICS_INFO* gi) {

View File

@ -31,14 +31,14 @@ public:
bool pending_msg(int); // returns true a message is waiting
// in the specified segment
bool get_msg(char *,int); // returns the message from the specified
bool get_msg(char *,int); // returns the message from the specified
// segment and resets the message flag
bool send_msg(char *,int); // if there is not already a message in the segment,
bool send_msg(char *,int); // if there is not already a message in the segment,
// writes specified message and sets message flag
bool send_graphics_mode_msg(int seg, int mode);
bool get_graphics_mode_msg(int seg, int& mode);
void reset_msgs(); // resets all messages and clears their flags
void reset_msg(int); // resets specified message and clears its flag
bool send_graphics_mode_msg(int seg, int mode);
bool get_graphics_mode_msg(int seg, int& mode);
void reset_msgs(); // resets all messages and clears their flags
void reset_msg(int); // resets specified message and clears its flag
};
#include "boinc_api.h"
@ -61,7 +61,7 @@ int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi);
#define MODE_WINDOW 2
#define MODE_FULLSCREEN 3
#define END_SS_MSG "BOINC_SS_END"
#define END_SS_MSG "BOINC_SS_END"
extern char* xml_graphics_modes[5];

View File

@ -129,7 +129,7 @@ void boinc_sleep(double seconds) {
::Sleep((int)(1000*seconds));
#else
sleep((int)seconds);
usleep((int)fmod(seconds*1000000,1000000));
usleep((int)fmod(seconds*1000000,1000000));
#endif
}

1
todo
View File

@ -10,7 +10,6 @@ BUGS (arranged from high to low priority)
- show_message should expect \n, discard it if GUI
- show "---" for CPU time, %done of results not started yet
- Win GUI: line between menus and tabs
- message for client starting or exiting
- "show graphics" should not use right-click
- win GUI: reduce flicker?
- on major version change,