summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-08-08 23:20:26 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2016-08-08 23:20:26 (GMT)
commit747958c14caa03f48fdd3256d63601b513ca499c (patch)
tree29b0d634983b8af6e46f6e6668ccefd7cc4213d0
parent54860ee6b8fe1ad33977eca490200929ea9cfac5 (diff)
downloadnetsurf-747958c14caa03f48fdd3256d63601b513ca499c.tar.gz
netsurf-747958c14caa03f48fdd3256d63601b513ca499c.tar.bz2
Scheduler debug logging
-rwxr-xr-xfrontends/amiga/schedule.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index 2d63465..6b8ee8b 100755
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -177,6 +177,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
nscb = ami_schedule_locate(callback, p, true);
if(nscb != NULL) {
+ LOG("Event scheduled for following time was deleted: %ld.%ld", nscb->tv.Seconds, nscb->tv.Microseconds);
ami_schedule_remove_timer_event(nscb);
ami_misc_itempool_free(pool_nscb, nscb, sizeof(struct nscallback));
pblHeapConstruct(schedule_list);
@@ -220,7 +221,7 @@ static int ami_schedule_compare(const void *prev, const void *next)
* venture to later scheduled events until the next time it is called -
* immediately afterwards, if we're in a timer signalled loop.
*/
-static void ami_scheduler_run(void)
+static bool ami_scheduler_run(void)
{
struct nscallback *nscb;
struct TimeVal tv;
@@ -228,14 +229,20 @@ static void ami_scheduler_run(void)
void *p;
nscb = pblHeapGetFirst(schedule_list);
- if(nscb == -1) return;
+ if(nscb == -1) {
+ LOG("Scheduler has no tasks to run!");
+ return false;
+ }
/* Ensure the scheduled event time has passed (CmpTime<=0)
* in case something been deleted between the timer
* signalling us and us responding to it.
*/
GetSysTime(&tv);
- if(CmpTime(&tv, &nscb->tv) > 0) return;
+ if(CmpTime(&tv, &nscb->tv) > 0) {
+ LOG("Scheduled time of next event has not passed: %ld.%ld < %ld.%ld", tv.Seconds, tv.Microseconds, nscb->tv.Seconds, nscb->tv.Microseconds);
+ return false;
+ }
callback = nscb->callback;
p = nscb->p;
@@ -247,7 +254,7 @@ static void ami_scheduler_run(void)
LOG("Running scheduled callback %p with arg %p", callback, p);
callback(p);
- return;
+ return true;
}
static void ami_schedule_open_timer(struct MsgPort *msgport)