|
NetSurf
|
#include "amiga/os3support.h"#include <proto/dos.h>#include <proto/exec.h>#include <proto/timer.h>#include <proto/utility.h>#include <stdio.h>#include <stdbool.h>#include <pbl.h>#include "utils/errors.h"#include "utils/log.h"#include "amiga/memory.h"#include "amiga/schedule.h"Go to the source code of this file.
Data Structures | |
| struct | nscallback |
| scheduled callback. More... | |
Functions | |
| static void | ami_schedule_remove_timer_event (struct nscallback *nscb) |
| Remove timer event. More... | |
| static nserror | ami_schedule_add_timer_event (struct nscallback *nscb, int t) |
| Add timer event. More... | |
| static struct nscallback * | ami_schedule_locate (void(*callback)(void *p), void *p, bool remove) |
| Locate a scheduled callback. More... | |
| static nserror | ami_schedule_reschedule (struct nscallback *nscb, int t) |
| Reschedule a callback. More... | |
| static nserror | schedule_remove (void(*callback)(void *p), void *p, bool abort) |
| Unschedule a callback. More... | |
| static void | schedule_remove_all (void) |
| static int | ami_schedule_compare (const void *prev, const void *next) |
| static void | ami_schedule_dump (void) |
| static bool | ami_scheduler_run (struct nscallback *nscb) |
| Process signalled event. More... | |
| static void | ami_schedule_open_timer (struct MsgPort *msgport) |
| static void | ami_schedule_close_timer (void) |
| nserror | ami_schedule_create (struct MsgPort *msgport) |
| Initialise amiga scheduler. More... | |
| void | ami_schedule_free (void) |
| Finalise amiga scheduler. More... | |
| nserror | ami_schedule (int t, void(*callback)(void *p), void *p) |
| Schedule a callback. More... | |
| void | ami_schedule_handle (struct MsgPort *nsmsgport) |
| Handle a message received from the scheduler process. More... | |
Variables | |
| static struct nscallback * | tioreq |
| struct Device * | TimerBase |
| static struct MsgPort * | schedule_msgport = NULL |
| static PblHeap * | schedule_list |
| nserror ami_schedule | ( | int | t, |
| void(*)(void *p) | callback, | ||
| void * | p | ||
| ) |
Schedule a callback.
| t | interval before the callback should be made / ms |
| callback | callback function |
| p | user parameter, passed to callback function |
The callback function will be called as soon as possible after t ms have passed.
Definition at line 331 of file schedule.c.
References AllocSysObjectTags, ami_schedule_add_timer_event(), ami_schedule_locate(), ami_schedule_reschedule(), ASOT_IOREQUEST, nscallback::callback, NSERROR_INIT_FAILED, NSERROR_NOMEM, NSERROR_OK, nscallback::p, schedule_list, schedule_msgport, schedule_remove(), and tioreq.
Referenced by ami_corewindow_fini(), ami_cw_redraw(), ami_font_cache_cleanup(), ami_font_cache_fini(), ami_font_cache_init(), ami_gui_event(), ami_memory_handler(), ami_pageinfo_event(), ami_pageinfo_mouse(), ami_schedule_redraw(), ami_schedule_redraw_remove(), ami_throbber_redraw_schedule(), amiga_bitmap_destroy(), amiga_bitmap_get_buffer(), amiga_bitmap_modified(), gui_window_create(), gui_window_destroy(), and HOOKF().
|
static |
Add timer event.
| nscb | callback |
| t | time in ms |
NetSurf will be signalled in t ms for this event.
Definition at line 81 of file schedule.c.
References TimeVal::Microseconds, NSERROR_OK, TimeRequest::Request, TimeVal::Seconds, TimeRequest::Time, nscallback::timereq, and nscallback::tv.
Referenced by ami_schedule(), and ami_schedule_reschedule().
|
static |
Definition at line 292 of file schedule.c.
References ASOT_IOREQUEST, FreeSysObject(), and tioreq.
Referenced by ami_schedule_free().
|
static |
Definition at line 207 of file schedule.c.
References nscallback::next, and nscallback::tv.
Referenced by ami_schedule_create().
| nserror ami_schedule_create | ( | struct MsgPort * | msgport | ) |
Initialise amiga scheduler.
| msgport | opened message port |
Definition at line 302 of file schedule.c.
References ami_schedule_compare(), ami_schedule_open_timer(), NSERROR_NOMEM, NSERROR_OK, schedule_list, and schedule_msgport.
Referenced by ami_gui_resources_open().
|
static |
Definition at line 217 of file schedule.c.
References nscallback::callback, TimeVal::Microseconds, NSLOG, nscallback::p, schedule_list, TimeVal::Seconds, and nscallback::tv.
Referenced by ami_schedule_free().
| void ami_schedule_free | ( | void | ) |
Finalise amiga scheduler.
Definition at line 320 of file schedule.c.
References ami_schedule_close_timer(), ami_schedule_dump(), schedule_list, and schedule_remove_all().
Referenced by ami_gui_resources_free().
| void ami_schedule_handle | ( | struct MsgPort * | nsmsgport | ) |
Handle a message received from the scheduler process.
| nsmsgport | Message port to process. |
Definition at line 369 of file schedule.c.
References ami_scheduler_run().
Referenced by ami_get_msg().
|
static |
Locate a scheduled callback.
| callback | callback function |
| p | user parameter, passed to callback function |
| remove | remove callback from the heap |
A scheduled callback matching both callback and p is returned, or NULL if none present.
Definition at line 111 of file schedule.c.
References nscallback::callback, nscallback::p, and schedule_list.
Referenced by ami_schedule(), and schedule_remove().
|
static |
Definition at line 272 of file schedule.c.
References AllocSysObjectTags, ASO_NoTrack, ASOT_IOREQUEST, TimeRequest::Request, TimerBase, nscallback::timereq, and tioreq.
Referenced by ami_schedule_create().
|
static |
Remove timer event.
| nscb | callback |
The timer event for the callback is aborted
Definition at line 62 of file schedule.c.
Referenced by ami_schedule_reschedule(), schedule_remove(), and schedule_remove_all().
|
static |
Reschedule a callback.
| nscb | callback |
| t | time in ms |
The nscallback will be rescheduled for t ms.
Definition at line 146 of file schedule.c.
References ami_schedule_add_timer_event(), ami_schedule_remove_timer_event(), NSERROR_NOMEM, NSERROR_OK, and schedule_list.
Referenced by ami_schedule().
|
static |
Process signalled event.
This implementation only processes the callback that arrives in the message from timer.device.
Definition at line 258 of file schedule.c.
References nscallback::callback, nscallback::p, and schedule_remove().
Referenced by ami_schedule_handle().
|
static |
Unschedule a callback.
| callback | callback function |
| p | user parameter, passed to callback function |
| abort | abort pending timer |
All scheduled callbacks matching both callback and p are removed.
Definition at line 166 of file schedule.c.
References ami_schedule_locate(), ami_schedule_remove_timer_event(), ASOT_IOREQUEST, nscallback::callback, FreeSysObject(), NSERROR_OK, nscallback::p, and schedule_list.
Referenced by ami_schedule(), and ami_scheduler_run().
|
static |
Definition at line 185 of file schedule.c.
References ami_schedule_remove_timer_event(), ASOT_IOREQUEST, FreeSysObject(), and schedule_list.
Referenced by ami_schedule_free().
|
static |
Definition at line 52 of file schedule.c.
Referenced by ami_schedule(), ami_schedule_create(), ami_schedule_dump(), ami_schedule_free(), ami_schedule_locate(), ami_schedule_reschedule(), schedule_remove(), and schedule_remove_all().
|
static |
Definition at line 49 of file schedule.c.
Referenced by ami_schedule(), and ami_schedule_create().
| struct Device* TimerBase |
Definition at line 45 of file schedule.c.
Referenced by ami_schedule_open_timer().
|
static |
Definition at line 44 of file schedule.c.
Referenced by ami_schedule(), ami_schedule_close_timer(), and ami_schedule_open_timer().