NetSurf
Functions
schedule.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nserror win32_schedule (int ival, void(*callback)(void *p), void *p)
 Schedule a callback. More...
 
int schedule_run (void)
 Process scheduled callbacks up to current time. More...
 
void list_schedule (void)
 LOG all current scheduled events. More...
 

Function Documentation

◆ list_schedule()

void list_schedule ( void  )

LOG all current scheduled events.

Definition at line 210 of file schedule.c.

References max_scheduled, MS_NOW, nscallback::next, NSLOG, schedule_list, nscallback::timeout, and nscallback::tv.

◆ schedule_run()

int schedule_run ( void  )

Process scheduled callbacks up to current time.

This walks the list of outstanding scheduled events and dispatches them if they have met their scheduled time. Due to legacy issues there are a couple of subtleties with how this operates:

  • Generally there are so few entries on the list the overhead of ordering the list exceeds the cost of simply enumerating them.
  • The scheduled time is the time after which we should call the operation back, this can result in the next scheduled time being zero. This is exceedingly rare as the core schedules in 10ms (cs) quanta and we almost always get called to schedule after the event time.
  • The callbacks can cause the schedule list to be re-arranged added to or even completely deleted. This means we must reset the list enumeration to the beginning every time an event is dispatched.
Returns
The number of milliseconds untill the next scheduled event or -1 for no event.

Process scheduled callbacks up to current time.

Returns
The number of miliseconds until the next scheduled event.

Definition at line 137 of file schedule.c.

References nscallback::callback, _nsbeos_callback_t::callback, _nsgtk_callback_t::callback, sched_entry::callback, _nsbeos_callback_t::callback_killed, _nsgtk_callback_t::callback_killed, callbacks, _nsbeos_callback_t::context, _nsgtk_callback_t::context, cur_scheduled, earliest_callback_timeout, MS_NOW, nscallback::next, sched_entry::next, NSLOG, nscallback::p, sched_entry::p, pending_callbacks, sched_active, sched_queue, sched_time, schedule_list, this_run, sched_entry::time, nscallback::timeout, _nsbeos_callback_t::timeout, timercmp, timersub, and nscallback::tv.

Referenced by atari_poll(), framebuffer_run(), nsbeos_gui_poll(), nsgtk_main(), riscos_poll(), and win32_run().

Here is the caller graph for this function:

◆ win32_schedule()

nserror win32_schedule ( int  ival,
void(*)(void *p)  callback,
void *  p 
)

Schedule a callback.

Parameters
ivalinterval before the callback should be made in ms
callbackcallback function
puser parameter, passed to callback function

The callback function will be called as soon as possible after t ms have passed.

Definition at line 99 of file schedule.c.

References nscallback::callback, nscallback::next, NSERROR_NOMEM, NSERROR_OK, NSLOG, nscallback::p, schedule_list, schedule_remove(), timeradd, and nscallback::tv.

Referenced by nsws_download_clear_data(), nsws_download_update_label(), and nsws_download_update_progress().

Here is the call graph for this function:
Here is the caller graph for this function: