diff --git a/api/boinc_api.C b/api/boinc_api.C index a481c52920..fb70f243b2 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -99,6 +99,7 @@ static bool ready_to_redraw = false; static bool this_process_active; static bool time_to_suspend = false,time_to_quit = false; int ok_to_draw = 0; +bool using_opengl = false; // read the INIT_DATA and FD_INIT files // @@ -160,8 +161,8 @@ int boinc_init() { time_until_suspend_check = 1; // check every 1 second for suspend request from core client this_process_active = true; - set_timer(timer_period); boinc_install_signal_handlers(); + set_timer(timer_period); return 0; } @@ -338,10 +339,12 @@ int boinc_finish(int status) { // Stop the timer timeKillEvent(timer_id); #ifdef BOINC_APP_GRAPHICS - // If the graphics thread is running, tell it to quit and wait for it - win_loop_done = TRUE; - if (hQuitEvent != NULL) { - WaitForSingleObject(hQuitEvent, 1000); // Wait up to 1000 ms + if (using_opengl) { + // If the graphics thread is running, tell it to quit and wait for it + win_loop_done = TRUE; + if (hQuitEvent != NULL) { + WaitForSingleObject(hQuitEvent, 1000); // Wait up to 1000 ms + } } #endif #endif @@ -379,7 +382,7 @@ int boinc_resolve_filename(char *virtual_name, char *physical_name, int len) { bool boinc_time_to_checkpoint() { // Tell the graphics thread it's OK to draw now #ifdef BOINC_APP_GRAPHICS - if (ready_to_redraw) { + if (ready_to_redraw && using_opengl) { ok_to_draw = 1; // And wait for the graphics thread to notify us that it's done drawing #ifdef _WIN32 @@ -661,6 +664,9 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { int write_fraction_done_file(double pct, double cpu, double checkpoint_cpu) { FILE* f = fopen(FRACTION_DONE_FILE, "w"); + if (!f) + return -1; + fprintf(f, "%f\n" "%f\n" diff --git a/api/windows_opengl.cpp b/api/windows_opengl.cpp index 14e6451fd4..54d260cd31 100755 --- a/api/windows_opengl.cpp +++ b/api/windows_opengl.cpp @@ -47,6 +47,7 @@ GLuint main_font; // Base Display List For The Font Set GLfloat cnt1; // 1st Counter Used To Move Text & For Coloring GLfloat cnt2; // 2nd Counter Used To Move Text & For Coloring +extern bool using_opengl; bool keys[256]; bool active=TRUE; // Window Active Flag Set To TRUE By Default bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default @@ -442,6 +443,7 @@ DWORD WINAPI win_graphics_event_loop( LPVOID gi ) { return 0; // Quit this thread if window was not created } cur_gfx_mode = MODE_NO_GRAPHICS; + using_opengl = true; while(!win_loop_done) // Loop That Runs While done=FALSE {