make schedule_run return if it has active jobs to schedule

svn path=/trunk/netsurf/; revision=6447
This commit is contained in:
Vincent Sanders 2009-02-11 22:33:55 +00:00
parent 5060882795
commit cbf07e1bc3
6 changed files with 15 additions and 10 deletions

View File

@ -115,7 +115,7 @@ void schedule_remove(void (*callback)(void *p), void *p)
* Process events up to current time. * Process events up to current time.
*/ */
void schedule_run(void) bool schedule_run(void)
{ {
struct nsObject *node; struct nsObject *node;
struct nsObject *nnode; struct nsObject *nnode;
@ -124,7 +124,7 @@ void schedule_run(void)
void *p; void *p;
struct timeval tv; struct timeval tv;
if(IsMinListEmpty(schedule_list)) return; if(IsMinListEmpty(schedule_list)) return false;
GetSysTime(&tv); GetSysTime(&tv);
@ -148,6 +148,8 @@ void schedule_run(void)
} }
} }
} while(node=nnode); } while(node=nnode);
return true;
} }
void ami_remove_timer_event(struct nscallback *nscb) void ami_remove_timer_event(struct nscallback *nscb)

View File

@ -202,7 +202,7 @@ void tree_set_node_sprite_folder(struct node *node) {}
#ifndef riscos #ifndef riscos
void schedule(int t, void (*callback)(void *p), void *p) {} void schedule(int t, void (*callback)(void *p), void *p) {}
void schedule_remove(void (*callback)(void *p), void *p) {} void schedule_remove(void (*callback)(void *p), void *p) {}
void schedule_run(void) {} bool schedule_run(void) {}
#endif #endif
bool selection_highlighted(struct selection *s, unsigned start, unsigned end, bool selection_highlighted(struct selection *s, unsigned start, unsigned end,

View File

@ -265,7 +265,7 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
/* In platform specific schedule.c. */ /* In platform specific schedule.c. */
void schedule(int t, void (*callback)(void *p), void *p); void schedule(int t, void (*callback)(void *p), void *p);
void schedule_remove(void (*callback)(void *p), void *p); void schedule_remove(void (*callback)(void *p), void *p);
void schedule_run(void); bool schedule_run(void);
/* In platform specific theme_install.c. */ /* In platform specific theme_install.c. */
#ifdef WITH_THEME_INSTALL #ifdef WITH_THEME_INSTALL

View File

@ -126,7 +126,7 @@ void schedule_remove(void (*callback)(void *p), void *p)
* Process events up to current time. * Process events up to current time.
*/ */
void schedule_run(void) bool schedule_run(void)
{ {
struct timeval tv; struct timeval tv;
struct nscallback *cur_nscb; struct nscallback *cur_nscb;
@ -134,7 +134,7 @@ void schedule_run(void)
struct nscallback *unlnk_nscb; struct nscallback *unlnk_nscb;
if (schedule_list == NULL) if (schedule_list == NULL)
return; return false;
cur_nscb = schedule_list; cur_nscb = schedule_list;
prev_nscb = NULL; prev_nscb = NULL;
@ -167,7 +167,7 @@ void schedule_run(void)
cur_nscb = prev_nscb->next; cur_nscb = prev_nscb->next;
} }
} }
return true;
} }
void list_schedule(void) void list_schedule(void)

View File

@ -107,14 +107,14 @@ schedule(int t, void (*callback)(void *p), void *p)
g_timeout_add(msec_timeout, nsgtk_schedule_generic_callback, cb); g_timeout_add(msec_timeout, nsgtk_schedule_generic_callback, cb);
} }
void bool
schedule_run(void) schedule_run(void)
{ {
/* Capture this run of pending callbacks into the list. */ /* Capture this run of pending callbacks into the list. */
this_run = pending_callbacks; this_run = pending_callbacks;
if (this_run == NULL) if (this_run == NULL)
return; /* Nothing to do */ return false; /* Nothing to do */
/* Clear the pending list. */ /* Clear the pending list. */
pending_callbacks = NULL; pending_callbacks = NULL;
@ -129,4 +129,5 @@ schedule_run(void)
cb->callback(cb->context); cb->callback(cb->context);
free(cb); free(cb);
} }
return true;
} }

View File

@ -128,7 +128,7 @@ void schedule_remove(void (*callback)(void *p), void *p)
* Process events up to current time. * Process events up to current time.
*/ */
void schedule_run(void) bool schedule_run(void)
{ {
struct sched_entry *entry; struct sched_entry *entry;
void (*callback)(void *p); void (*callback)(void *p);
@ -153,4 +153,6 @@ void schedule_run(void)
sched_time = sched_queue.next->time; sched_time = sched_queue.next->time;
} else } else
sched_active = false; sched_active = false;
return sched_active;
} }