NetSurf
schedule.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef WINDOWS_SCHEDULE_H
20#define WINDOWS_SCHEDULE_H
21
22/**
23 * Schedule a callback.
24 *
25 * \param ival interval before the callback should be made in ms
26 * \param callback callback function
27 * \param p user parameter, passed to callback function
28 *
29 * The callback function will be called as soon as possible after t ms have
30 * passed.
31 */
32nserror win32_schedule(int ival, void (*callback)(void *p), void *p);
33
34/**
35 * Process scheduled callbacks up to current time.
36 *
37 * This walks the list of outstanding scheduled events and dispatches
38 * them if they have met their scheduled time. Due to legacy issues
39 * there are a couple of subtleties with how this operates:
40 *
41 * - Generally there are so few entries on the list the overhead of
42 * ordering the list exceeds the cost of simply enumerating them.
43 *
44 * - The scheduled time is the time *after* which we should call the
45 * operation back, this can result in the next scheduled time
46 * being zero. This is exceedingly rare as the core schedules in
47 * 10ms (cs) quanta and we almost always get called to schedule
48 * after the event time.
49 *
50 * - The callbacks can cause the schedule list to be re-arranged added
51 * to or even completely deleted. This means we must reset the
52 * list enumeration to the beginning every time an event is
53 * dispatched.
54 *
55 * @return The number of milliseconds untill the next scheduled event
56 * or -1 for no event.
57 */
58int schedule_run(void);
59
60/**
61 * LOG all current scheduled events.
62 */
63void list_schedule(void);
64
65#endif
void list_schedule(void)
LOG all current scheduled events.
Definition: schedule.c:210
int schedule_run(void)
Process events up to current time.
Definition: schedule.c:137
nserror
Enumeration of error codes.
Definition: errors.h:29
nserror win32_schedule(int ival, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:99