NetSurf
Data Structures | Functions | Variables
schedule.c File Reference
#include <glib.h>
#include <stdlib.h>
#include <stdbool.h>
#include "utils/errors.h"
#include "utils/log.h"
#include "gtk/schedule.h"
Include dependency graph for schedule.c:

Go to the source code of this file.

Data Structures

struct  _nsgtk_callback_t
 Killable callback closure embodiment. More...
 

Functions

static gboolean nsgtk_schedule_generic_callback (gpointer data)
 
static void nsgtk_schedule_kill_callback (void *_target, void *_match)
 
static nserror schedule_remove (void(*callback)(void *p), void *cbctx)
 remove a matching callback and context tuple from all lists More...
 
nserror nsgtk_schedule (int t, void(*callback)(void *p), void *cbctx)
 
bool schedule_run (void)
 Process events up to current time. More...
 

Variables

static GList * pending_callbacks = NULL
 List of callbacks which have occurred and are pending running. More...
 
static GList * queued_callbacks = NULL
 List of callbacks which are queued to occur in the future. More...
 
static GList * this_run = NULL
 List of callbacks which are about to be run in this schedule_run. More...
 

Function Documentation

◆ nsgtk_schedule()

nserror nsgtk_schedule ( int  t,
void(*)(void *p)  callback,
void *  cbctx 
)

Definition at line 103 of file schedule.c.

References _nsgtk_callback_t::callback, _nsgtk_callback_t::callback_killed, _nsgtk_callback_t::context, NSERROR_OK, nsgtk_schedule_generic_callback(), queued_callbacks, and schedule_remove().

Referenced by gui_window_destroy(), next_throbber_frame(), nsgtk_toolbar_throbber(), throbber(), and toolbar_destroy_cb().

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

◆ nsgtk_schedule_generic_callback()

static gboolean nsgtk_schedule_generic_callback ( gpointer  data)
static

Definition at line 44 of file schedule.c.

References _nsgtk_callback_t::callback_killed, NSLOG, pending_callbacks, and queued_callbacks.

Referenced by nsgtk_schedule().

Here is the caller graph for this function:

◆ nsgtk_schedule_kill_callback()

static void nsgtk_schedule_kill_callback ( void *  _target,
void *  _match 
)
static

Definition at line 57 of file schedule.c.

References _nsgtk_callback_t::callback, _nsgtk_callback_t::callback_killed, _nsgtk_callback_t::context, and NSLOG.

Referenced by schedule_remove().

Here is the caller graph for this function:

◆ schedule_remove()

static nserror schedule_remove ( void(*)(void *p)  callback,
void *  cbctx 
)
static

remove a matching callback and context tuple from all lists

Parameters
callbackThe callback to match
cbctxThe callback context to match
Returns
NSERROR_OK if the tuple was removed from at least one list else NSERROR_NOT_FOUND

Definition at line 81 of file schedule.c.

References _nsgtk_callback_t::callback, _nsgtk_callback_t::callback_killed, NSERROR_NOT_FOUND, NSERROR_OK, nsgtk_schedule_kill_callback(), pending_callbacks, queued_callbacks, and this_run.

Referenced by nsgtk_schedule().

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

◆ schedule_run()

bool schedule_run ( void  )

Process events up to current time.

Process scheduled callbacks up to current time.

Returns
The number of miliseconds until the next scheduled event.

Definition at line 128 of file schedule.c.

References _nsgtk_callback_t::callback, _nsgtk_callback_t::callback_killed, _nsgtk_callback_t::context, NSLOG, pending_callbacks, and this_run.

Variable Documentation

◆ pending_callbacks

GList* pending_callbacks = NULL
static

List of callbacks which have occurred and are pending running.

Definition at line 37 of file schedule.c.

Referenced by nsgtk_schedule_generic_callback(), schedule_remove(), and schedule_run().

◆ queued_callbacks

GList* queued_callbacks = NULL
static

List of callbacks which are queued to occur in the future.

Definition at line 39 of file schedule.c.

Referenced by nsgtk_schedule(), nsgtk_schedule_generic_callback(), and schedule_remove().

◆ this_run

GList* this_run = NULL
static

List of callbacks which are about to be run in this schedule_run.

Definition at line 41 of file schedule.c.

Referenced by schedule_remove(), and schedule_run().