summary refs log tree commit diff stats
path: root/cpu-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpu-common.c')
-rw-r--r--cpu-common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpu-common.c b/cpu-common.c
index ce78273af5..7ae136f98c 100644
--- a/cpu-common.c
+++ b/cpu-common.c
@@ -331,6 +331,17 @@ void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func,
     queue_work_on_cpu(cpu, wi);
 }
 
+void free_queued_cpu_work(CPUState *cpu)
+{
+    while (!QSIMPLEQ_EMPTY(&cpu->work_list)) {
+        struct qemu_work_item *wi = QSIMPLEQ_FIRST(&cpu->work_list);
+        QSIMPLEQ_REMOVE_HEAD(&cpu->work_list, node);
+        if (wi->free) {
+            g_free(wi);
+        }
+    }
+}
+
 void process_queued_cpu_work(CPUState *cpu)
 {
     struct qemu_work_item *wi;