*** empty log message ***

svn path=/trunk/boinc/; revision=4951
This commit is contained in:
David Anderson 2004-12-28 03:39:52 +00:00
parent 39813646bc
commit 177b530d0b
5 changed files with 40 additions and 11 deletions

View File

@ -193,23 +193,31 @@ void xwin_graphics_event_loop() {
char* args[] = {"foobar", 0};
int one=1;
static bool glut_inited = false;
int restarted;
graphics_thread = pthread_self();
atexit(restart);
int restarted = setjmp(jbuf);
try_again:
restarted = setjmp(jbuf);
if (restarted) {
if (!glut_inited) {
// here glutInit() must have failed and called exit().
// returning will cause the graphics thread to exit.
return;
}
//fprintf(stderr, "graphics thread restarted\n"); fflush(stderr);
if (glut_inited) {
// here the user must have closed the window,
// which causes GLUT to call exit().
//
#ifdef __APPLE_CC__
glutInit(&one, args);
glutInit(&one, args);
#endif
set_mode(MODE_HIDE_GRAPHICS);
set_mode(MODE_HIDE_GRAPHICS);
} else {
// here glutInit() must have failed and called exit().
//
sleep(60);
goto try_again;
}
} else {
glutInit(&one, args);
glut_inited = true;

View File

@ -21893,3 +21893,20 @@ David 27 Dec 2004
login_action.php
tools/
upgrade
David 27 Dec 2004
- UNIX app graphics: if glutInit() fails, keep retrying periodically
(in case user runs X server, e.g.)
- scheduler: scan the work array from a random point,
instead of always from the start.
This prevents a result from getting stuck at the end
of the array, and possibly never getting sent.
(from Ben Herndon)
api/
x_opengl.C
lib/
util.h
sched/
main.C
sched_send.C

View File

@ -88,7 +88,7 @@ static inline double drand() {
return (double)rand()/(double)RAND_MAX;
}
// return a random integer in the range [rmin,rmax)
// return a random double in the range [rmin,rmax)
static inline double rand_range(double rmin, double rmax) {
if (rmin < rmax) {
return drand() * (rmax-rmin) + rmin;

View File

@ -108,6 +108,7 @@ int main() {
}
#endif
srand(time(0)+getpid());
log_messages.set_debug_level(DEBUG_LEVEL);
if (check_stop_sched()) {

View File

@ -523,7 +523,7 @@ static void scan_work_array(
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
SCHED_SHMEM& ss
) {
int i, retval, n;
int i, j, retval, n, rnd_off;
WORKUNIT wu;
DB_RESULT result;
char buf[256];
@ -534,7 +534,10 @@ static void scan_work_array(
if (wreq.disk_available < 0) wreq.insufficient_disk = true;
lock_sema();
for (i=0; i<ss.nwu_results; i++) {
rnd_off = rand() % ss.nwu_results;
for (j=0; j<ss.nwu_results; j++) {
i = (j+rnd_off) % ss.nwu_results;
if (!wreq.work_needed(reply)) break;
WU_RESULT& wu_result = ss.wu_results[i];