aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlex Bligh <alex@alex.org.uk>2013-08-21 16:02:50 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-08-22 19:10:28 +0200
commitd5541d86806acc2e1a3cf9e1402370ba884e9fe1 (patch)
tree060b78658b1670a132a9ec8f5e4d8f3f1bbb2ed4 /include
parentdae21b98b973e8d878a92b44f70a51aa8d4c739b (diff)
aio / timers: Add a notify callback to QEMUTimerList
Add a notify pointer to QEMUTimerList so it knows what to notify on a timer change. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/timer.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 6f1ec76a57..cb7321c003 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -59,6 +59,7 @@ struct QEMUTimerListGroup {
};
typedef void QEMUTimerCB(void *opaque);
+typedef void QEMUTimerListNotifyCB(void *opaque);
struct QEMUTimer {
int64_t expire_time; /* in nanoseconds */
@@ -137,13 +138,16 @@ QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClock *clock);
/**
* timerlist_new:
* @type: the clock type to associate with the timerlist
+ * @cb: the callback to call on notification
+ * @opaque: the opaque pointer to pass to the callback
*
* Create a new timerlist associated with the clock of
* type @type.
*
* Returns: a pointer to the QEMUTimerList created
*/
-QEMUTimerList *timerlist_new(QEMUClockType type);
+QEMUTimerList *timerlist_new(QEMUClockType type,
+ QEMUTimerListNotifyCB *cb, void *opaque);
/**
* timerlist_free:
@@ -224,13 +228,28 @@ QEMUClock *timerlist_get_clock(QEMUTimerList *timer_list);
bool timerlist_run_timers(QEMUTimerList *timer_list);
/**
+ * timerlist_notify:
+ * @timer_list: the timer list to use
+ *
+ * call the notifier callback associated with the timer list.
+ */
+void timerlist_notify(QEMUTimerList *timer_list);
+
+/**
* timerlistgroup_init:
* @tlg: the timer list group
+ * @cb: the callback to call when a notify is required
+ * @opaque: the opaque pointer to be passed to the callback.
*
* Initialise a timer list group. This must already be
- * allocated in memory and zeroed.
- */
-void timerlistgroup_init(QEMUTimerListGroup *tlg);
+ * allocated in memory and zeroed. The notifier callback is
+ * called whenever a clock in the timer list group is
+ * reenabled or whenever a timer associated with any timer
+ * list is modified. If @cb is specified as null, qemu_notify()
+ * is used instead.
+ */
+void timerlistgroup_init(QEMUTimerListGroup *tlg,
+ QEMUTimerListNotifyCB *cb, void *opaque);
/**
* timerlistgroup_deinit: