NetSurf
|
Scheduled callback queue (implementation). More...
#include <stdbool.h>
#include <stdlib.h>
#include "oslib/os.h"
#include "utils/log.h"
#include "riscos/gui.h"
Go to the source code of this file.
Data Structures | |
struct | sched_entry |
Entry in the queue of scheduled callbacks. More... | |
Functions | |
static nserror | schedule_remove (void(*callback)(void *p), void *p) |
Unschedule a callback. More... | |
nserror | riscos_schedule (int t, void(*callback)(void *p), void *p) |
Schedule a callback. More... | |
bool | schedule_run (void) |
Process events up to current time. More... | |
Variables | |
static struct sched_entry | sched_queue = { 0, 0, 0, 0 } |
Queue of scheduled callbacks (sentinel at head). More... | |
bool | sched_active = false |
Items have been scheduled. More... | |
os_t | sched_time |
Time of soonest scheduled event (valid only if sched_active is true). More... | |
Scheduled callback queue (implementation).
The queue is simply implemented as a linked list.
Definition in file schedule.c.
nserror riscos_schedule | ( | int | t, |
void(*)(void *p) | callback, | ||
void * | p | ||
) |
Schedule a callback.
t | interval before the callback should be made in 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 93 of file schedule.c.
References sched_entry::callback, sched_entry::next, NSERROR_NOMEM, NSERROR_OK, NSLOG, sched_entry::p, sched_active, sched_queue, sched_time, schedule_remove(), and sched_entry::time.
Referenced by gui_download_window_done(), gui_download_window_error(), ro_gui_download_datasave_ack(), ro_gui_download_keypress(), ro_gui_download_overwrite_confirmed(), ro_gui_download_send_dataload(), ro_gui_download_update_status(), ro_gui_download_window_destroy(), ro_gui_hotlist_add_page(), ro_gui_hotlist_addurl_bounce(), ro_gui_progress_bar_animate(), ro_gui_progress_bar_destroy(), ro_gui_progress_bar_update(), ro_gui_status_bar_destroy(), and ro_gui_status_bar_set_text().
|
static |
Unschedule a callback.
callback | callback function |
p | user parameter, passed to callback function |
All scheduled callbacks matching both callback and p are removed.
Definition at line 63 of file schedule.c.
References sched_entry::callback, sched_entry::next, NSERROR_OK, sched_entry::p, sched_active, sched_queue, sched_time, and sched_entry::time.
Referenced by riscos_schedule().
bool schedule_run | ( | void | ) |
Process events up to current time.
Process scheduled callbacks up to current time.
Definition at line 134 of file schedule.c.
References sched_entry::callback, sched_entry::next, sched_entry::p, sched_active, sched_queue, sched_time, and sched_entry::time.
bool sched_active = false |
Items have been scheduled.
Definition at line 50 of file schedule.c.
Referenced by riscos_poll(), riscos_schedule(), schedule_remove(), and schedule_run().
|
static |
Queue of scheduled callbacks (sentinel at head).
Definition at line 47 of file schedule.c.
Referenced by riscos_schedule(), schedule_remove(), and schedule_run().
os_t sched_time |
Time of soonest scheduled event (valid only if sched_active is true).
Definition at line 52 of file schedule.c.
Referenced by riscos_poll(), riscos_schedule(), schedule_remove(), and schedule_run().