mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
Fix framebufefr port callback scheduling
svn path=/trunk/netsurf/; revision=6838
This commit is contained in:
parent
da3b0227a7
commit
d471e0fd25
@ -58,10 +58,10 @@ void schedule(int cs_ival, void (*callback)(void *p), void *p)
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = cs_ival * 10000;
|
||||
|
||||
LOG(("adding callback %p, %p at %d cs", callback, p, cs_ival));
|
||||
|
||||
nscb = calloc(1, sizeof(struct nscallback));
|
||||
|
||||
LOG(("adding callback %p for %p(%p) at %d cs", nscb, callback, p, cs_ival));
|
||||
|
||||
gettimeofday(&nscb->tv, NULL);
|
||||
timeradd(&nscb->tv, &tv, &nscb->tv);
|
||||
|
||||
@ -101,8 +101,8 @@ void schedule_remove(void (*callback)(void *p), void *p)
|
||||
(cur_nscb->p == p)) {
|
||||
/* item to remove */
|
||||
|
||||
LOG(("removing %p(%p)",
|
||||
cur_nscb->callback, cur_nscb->p));
|
||||
LOG(("callback entry %p removing %p(%p)",
|
||||
cur_nscb, cur_nscb->callback, cur_nscb->p));
|
||||
|
||||
/* remove callback */
|
||||
unlnk_nscb = cur_nscb;
|
||||
@ -147,20 +147,26 @@ bool schedule_run(void)
|
||||
|
||||
/* remove callback */
|
||||
unlnk_nscb = cur_nscb;
|
||||
cur_nscb = unlnk_nscb->next;
|
||||
|
||||
if (prev_nscb == NULL) {
|
||||
schedule_list = cur_nscb;
|
||||
schedule_list = unlnk_nscb->next;
|
||||
} else {
|
||||
prev_nscb->next = cur_nscb;
|
||||
prev_nscb->next = unlnk_nscb->next;
|
||||
}
|
||||
|
||||
LOG(("calling %p with %p",
|
||||
unlnk_nscb->callback, unlnk_nscb->p));
|
||||
LOG(("callback entry %p running %p(%p)",
|
||||
unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p));
|
||||
/* call callback */
|
||||
unlnk_nscb->callback(unlnk_nscb->p);
|
||||
|
||||
free (unlnk_nscb);
|
||||
|
||||
/* the callback might have modded the list, so start
|
||||
* again
|
||||
*/
|
||||
cur_nscb = schedule_list;
|
||||
prev_nscb = NULL;
|
||||
|
||||
} else {
|
||||
/* move to next element */
|
||||
prev_nscb = cur_nscb;
|
||||
|
Loading…
Reference in New Issue
Block a user