[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/17] include/qemu/thread.h: Document qemu_thread_at
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 16/17] include/qemu/thread.h: Document qemu_thread_atexit* API |
Date: |
Tue, 6 Nov 2018 22:38:02 +0100 |
From: Peter Maydell <address@hidden>
Add documentation for the qemu_thread_atexit_add() and
qemu_thread_atexit_remove() functions.
We include a (previously undocumented) constraint that notifiers
may not be called if a thread is exiting because the entire
process is exiting. This is fine for our current use because
the callers use it only for cleaning up resources which go away
on process exit (memory, Win32 fibers), and we will need the
flexibility for the new posix implementation.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qemu/thread.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/qemu/thread.h b/include/qemu/thread.h
index b2661b6..55d83a9 100644
--- a/include/qemu/thread.h
+++ b/include/qemu/thread.h
@@ -162,7 +162,29 @@ void qemu_thread_exit(void *retval);
void qemu_thread_naming(bool enable);
struct Notifier;
+/**
+ * qemu_thread_atexit_add:
+ * @notifier: Notifier to add
+ *
+ * Add the specified notifier to a list which will be run via
+ * notifier_list_notify() when this thread exits (either by calling
+ * qemu_thread_exit() or by returning from its start_routine).
+ * The usual usage is that the caller passes a Notifier which is
+ * a per-thread variable; it can then use the callback to free
+ * other per-thread data.
+ *
+ * If the thread exits as part of the entire process exiting,
+ * it is unspecified whether notifiers are called or not.
+ */
void qemu_thread_atexit_add(struct Notifier *notifier);
+/**
+ * qemu_thread_atexit_remove:
+ * @notifier: Notifier to remove
+ *
+ * Remove the specified notifier from the thread-exit notification
+ * list. It is not valid to try to remove a notifier which is not
+ * on the list.
+ */
void qemu_thread_atexit_remove(struct Notifier *notifier);
struct QemuSpin {
--
1.8.3.1
- [Qemu-devel] [PULL 00/17] Misc patches for QEMU 3.1 hard freeze (?), Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 03/17] i386: clarify that the Q35 machine type implements a P35 chipset, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 13/17] scsi-generic: avoid out-of-bounds access to VPD page list, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 01/17] icount: fix deadlock when all cpus are sleeping, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 16/17] include/qemu/thread.h: Document qemu_thread_atexit* API,
Paolo Bonzini <=
- [Qemu-devel] [PULL 14/17] scsi-generic: avoid invalid access to struct when emulating block limits, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 05/17] MAINTAINERS: remove or downgrade myself to reviewer from some subsystems, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 17/17] util/qemu-thread-posix: Fix qemu_thread_atexit* for OSX, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 02/17] x86: hv_evmcs CPU flag support, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 12/17] scsi-generic: keep VPD page list sorted, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 11/17] lsi53c895a: check message length value is valid, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 15/17] scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 04/17] ivshmem: fix memory backend leak, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 10/17] scripts/dump-guest-memory: Synchronize with guest_phys_blocks_region_add, Paolo Bonzini, 2018/11/06
- [Qemu-devel] [PULL 09/17] memory-mapping: skip non-volatile memory regions in GuestPhysBlockList, Paolo Bonzini, 2018/11/06