aboutsummaryrefslogtreecommitdiff
path: root/main-loop.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-09-13 10:30:52 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-10-21 18:14:30 +0200
commitd3b12f5dec4b27ebab58fb5797cb67bacced773b (patch)
treed5fffa4392b778bf2b38cc7f50e8a1107b30103a /main-loop.h
parent44a9b356ad12e63acc1198d1fc356870050a214d (diff)
main-loop: create main-loop.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'main-loop.h')
-rw-r--r--main-loop.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/main-loop.h b/main-loop.h
index a73b9c0bbe..8a716b133f 100644
--- a/main-loop.h
+++ b/main-loop.h
@@ -315,6 +315,30 @@ void qemu_bh_delete(QEMUBH *bh);
int qemu_add_child_watch(pid_t pid);
#endif
+/**
+ * qemu_mutex_lock_iothread: Lock the main loop mutex.
+ *
+ * This function locks the main loop mutex. The mutex is taken by
+ * qemu_init_main_loop and always taken except while waiting on
+ * external events (such as with select). The mutex should be taken
+ * by threads other than the main loop thread when calling
+ * qemu_bh_new(), qemu_set_fd_handler() and basically all other
+ * functions documented in this file.
+ */
+void qemu_mutex_lock_iothread(void);
+
+/**
+ * qemu_mutex_unlock_iothread: Unlock the main loop mutex.
+ *
+ * This function unlocks the main loop mutex. The mutex is taken by
+ * qemu_init_main_loop and always taken except while waiting on
+ * external events (such as with select). The mutex should be unlocked
+ * as soon as possible by threads other than the main loop thread,
+ * because it prevents the main loop from processing callbacks,
+ * including timers and bottom halves.
+ */
+void qemu_mutex_unlock_iothread(void);
+
/* internal interfaces */
void qemu_iohandler_fill(int *pnfds, fd_set *readfds, fd_set *writefds, fd_set *xfds);