summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-08-11 17:14:07 (GMT)
committer Chris Young <chris@unsatisfactorysoftware.co.uk>2016-08-11 17:14:07 (GMT)
commitab7e5c293677ef736064b0e222c2b9ed5b654f12 (patch)
tree9597b0897d7db437dadba2a5b2eee640b5d7c74f
parent68b20a382d3c2fe23ebdd152ed39c0290bcc6fa7 (diff)
downloadnetsurf-ab7e5c293677ef736064b0e222c2b9ed5b654f12.tar.gz
netsurf-ab7e5c293677ef736064b0e222c2b9ed5b654f12.tar.bz2
Don't Abort/WaitIO when we've already removed it from the message queue (thx Georg)
-rw-r--r--frontends/amiga/schedule.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index ff93e90..1fa2658 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -159,11 +159,12 @@ static nserror ami_schedule_reschedule(struct nscallback *nscb, int t)
*
* \param callback callback function
* \param p user parameter, passed to callback function
+ * \param abort abort pending timer
*
* All scheduled callbacks matching both callback and p are removed.
*/
-static nserror schedule_remove(void (*callback)(void *p), void *p)
+static nserror schedule_remove(void (*callback)(void *p), void *p, bool abort)
{
struct nscallback *nscb;
@@ -171,7 +172,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p)
if(nscb != NULL) {
LOG("deleted callback %p", nscb);
- ami_schedule_remove_timer_event(nscb);
+ if(abort == true) ami_schedule_remove_timer_event(nscb);
FreeSysObject(ASOT_IOREQUEST, nscb);
pblHeapConstruct(schedule_list);
}
@@ -232,6 +233,11 @@ static void ami_schedule_dump(void)
LOG("nscb: %p, at %d-%d-%d %d:%d:%d.%d, callback: %p, %p",
nscb, clockdata.mday, clockdata.month, clockdata.year, clockdata.hour, clockdata.min, clockdata.sec,
nscb->tv.Microseconds, nscb->callback, nscb->p);
+ if(CheckIO((struct IORequest *)nscb) == NULL) {
+ LOG("-> ACTIVE");
+ } else {
+ LOG("-> COMPLETE");
+ }
};
pblIteratorFree(iterator);
@@ -260,7 +266,7 @@ static bool ami_scheduler_run(struct nscallback *nscb)
callback = nscb->callback;
p = nscb->p;
- schedule_remove(callback, p); /* this does a lookup as we don't know if we're the first item on the heap */
+ schedule_remove(callback, p, false); /* this does a lookup as we don't know if we're the first item on the heap */
LOG("Running scheduled callback %p with arg %p", callback, p);
callback(p);
@@ -332,7 +338,7 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p)
LOG("Scheduling callback %p with arg %p at time %d", callback, p, t);
if(schedule_list == NULL) return NSERROR_INIT_FAILED;
- if(t < 0) return schedule_remove(callback, p);
+ if(t < 0) return schedule_remove(callback, p, true);
if ((nscb = ami_schedule_locate(callback, p, false))) {
return ami_schedule_reschedule(nscb, t);