summaryrefslogtreecommitdiff
path: root/amiga/schedule.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-12 23:43:00 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-12 23:43:00 +0000
commitd514cf30ee443fc091d4b51afec5e2c086d49d4e (patch)
treeff558a93f3ae01beb4f6aeed1449773210f2f8c9 /amiga/schedule.c
parentef6443b132af8ca445b235b562a1bad816257f37 (diff)
downloadnetsurf-d514cf30ee443fc091d4b51afec5e2c086d49d4e.tar.gz
netsurf-d514cf30ee443fc091d4b51afec5e2c086d49d4e.tar.bz2
fix os4 build
Diffstat (limited to 'amiga/schedule.c')
-rwxr-xr-xamiga/schedule.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/amiga/schedule.c b/amiga/schedule.c
index 2ed264055..71d963d2b 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -31,11 +31,14 @@
#include "amiga/schedule.h"
+#ifndef NSA_NO_ASYNC
static struct MsgPort *smsgport = NULL; /* to send messages for the scheduler to */
+#endif
static struct TimeRequest *tioreq;
struct Device *TimerBase;
#ifdef __amigaos4__
struct TimerIFace *ITimer;
+#endif
struct nscallback
{
@@ -353,6 +356,31 @@ static void ami_schedule_free(struct MsgPort *msgport)
ami_schedule_close_timer(msgport);
}
+static nserror ami_scheduler_schedule(struct ami_schedule_message *asmsg)
+{
+ struct nscallback *nscb;
+
+ if(schedule_list == NULL) return NSERROR_INIT_FAILED;
+ if (asmsg->t < 0) return schedule_remove(asmsg->callback, asmsg->p);
+
+ if ((nscb = ami_schedule_locate(asmsg->callback, asmsg->p, false))) {
+ return ami_schedule_reschedule(nscb, asmsg->t);
+ }
+
+ nscb = AllocVecTagList(sizeof(struct nscallback), NULL);
+ if(!nscb) return NSERROR_NOMEM;
+
+ if (ami_schedule_add_timer_event(nscb, asmsg->t) != NSERROR_OK)
+ return NSERROR_NOMEM;
+
+ nscb->callback = asmsg->callback;
+ nscb->p = asmsg->p;
+
+ pblHeapInsert(schedule_list, nscb);
+
+ return NSERROR_OK;
+}
+
/* exported function documented in amiga/schedule.h */
nserror ami_schedule(int t, void (*callback)(void *p), void *p)
{
@@ -381,31 +409,6 @@ nserror ami_schedule(int t, void (*callback)(void *p), void *p)
return NSERROR_OK;
}
-static nserror ami_scheduler_schedule(struct ami_schedule_message *asmsg)
-{
- struct nscallback *nscb;
-
- if(schedule_list == NULL) return NSERROR_INIT_FAILED;
- if (asmsg->t < 0) return schedule_remove(asmsg->callback, asmsg->p);
-
- if ((nscb = ami_schedule_locate(asmsg->callback, asmsg->p, false))) {
- return ami_schedule_reschedule(nscb, asmsg->t);
- }
-
- nscb = AllocVecTagList(sizeof(struct nscallback), NULL);
- if(!nscb) return NSERROR_NOMEM;
-
- if (ami_schedule_add_timer_event(nscb, asmsg->t) != NSERROR_OK)
- return NSERROR_NOMEM;
-
- nscb->callback = asmsg->callback;
- nscb->p = asmsg->p;
-
- pblHeapInsert(schedule_list, nscb);
-
- return NSERROR_OK;
-}
-
/* exported interface documented in amiga/schedule.h */
void ami_schedule_handle(struct MsgPort *nsmsgport)
{
@@ -421,7 +424,6 @@ void ami_schedule_handle(struct MsgPort *nsmsgport)
*/
ReplyMsg((struct Message *)timermsg);
ami_scheduler_run(NULL);
- }
}
#else
struct ami_schedule_message *asmsg;