#include "qemu/timer.h"
#include "sysemu/replay.h"
#include "sysemu/sysemu.h"
+#include "sysemu/cpus.h"
#ifdef CONFIG_POSIX
#include <pthread.h>
g_free(timer_list);
}
-static void qemu_clock_init(QEMUClockType type)
+static void qemu_clock_init(QEMUClockType type, QEMUTimerListNotifyCB *notify_cb)
{
QEMUClock *clock = qemu_clock_ptr(type);
clock->last = INT64_MIN;
QLIST_INIT(&clock->timerlists);
notifier_list_init(&clock->reset_notifiers);
- main_loop_tlg.tl[type] = timerlist_new(type, NULL, NULL);
+ main_loop_tlg.tl[type] = timerlist_new(type, notify_cb, NULL);
}
bool qemu_clock_use_for_deadline(QEMUClockType type)
void timerlist_notify(QEMUTimerList *timer_list)
{
if (timer_list->notify_cb) {
- timer_list->notify_cb(timer_list->notify_opaque);
+ timer_list->notify_cb(timer_list->notify_opaque, timer_list->clock->type);
} else {
qemu_notify_event();
}
notifier_remove(notifier);
}
-void init_clocks(void)
+void init_clocks(QEMUTimerListNotifyCB *notify_cb)
{
QEMUClockType type;
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- qemu_clock_init(type);
+ qemu_clock_init(type, notify_cb);
}
#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK
QEMUClockType type;
for (type = 0; type < QEMU_CLOCK_MAX; type++) {
- progress |= qemu_clock_run_timers(type);
+ if (qemu_clock_use_for_deadline(type)) {
+ progress |= qemu_clock_run_timers(type);
+ }
}
return progress;