diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-10-23 16:06:13 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-10-23 16:06:13 +0100 |
commit | f78398bfe544db81a974825b0a2aa826f6576414 (patch) | |
tree | 80570fb8ae4638cfbb6df9d2377ddf940c9bcac8 /include | |
parent | 69717d0f890e14cbdd668297751f9446d2e2a8fd (diff) | |
parent | 23ee0ec2360b51619cae452c4faa8590dea74a6e (diff) |
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-10-22' into staging
nbd patches for 2019-10-22
- add ability for NBD client reconnect
# gpg: Signature made Wed 23 Oct 2019 02:53:08 BST
# gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg: aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A
* remotes/ericb/tags/pull-nbd-2019-10-22:
iotests: test nbd reconnect
block/nbd: nbd reconnect
qemu-coroutine-sleep: introduce qemu_co_sleep_wake
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/qemu/coroutine.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 9801e7f5a4..8d55663062 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -273,10 +273,29 @@ void qemu_co_rwlock_wrlock(CoRwlock *lock); */ void qemu_co_rwlock_unlock(CoRwlock *lock); +typedef struct QemuCoSleepState QemuCoSleepState; + +/** + * Yield the coroutine for a given duration. During this yield, @sleep_state + * (if not NULL) is set to an opaque pointer, which may be used for + * qemu_co_sleep_wake(). Be careful, the pointer is set back to zero when the + * timer fires. Don't save the obtained value to other variables and don't call + * qemu_co_sleep_wake from another aio context. + */ +void coroutine_fn qemu_co_sleep_ns_wakeable(QEMUClockType type, int64_t ns, + QemuCoSleepState **sleep_state); +static inline void coroutine_fn qemu_co_sleep_ns(QEMUClockType type, int64_t ns) +{ + qemu_co_sleep_ns_wakeable(type, ns, NULL); +} + /** - * Yield the coroutine for a given duration + * Wake a coroutine if it is sleeping in qemu_co_sleep_ns. The timer will be + * deleted. @sleep_state must be the variable whose address was given to + * qemu_co_sleep_ns() and should be checked to be non-NULL before calling + * qemu_co_sleep_wake(). */ -void coroutine_fn qemu_co_sleep_ns(QEMUClockType type, int64_t ns); +void qemu_co_sleep_wake(QemuCoSleepState *sleep_state); /** * Yield until a file descriptor becomes readable |