Skip to contentSkip to conversation

coroutine: Fix documentation of co_aio_sleep_ns()

PATCH In review Eric Blake 2 participants 3 messages Nov 8, 2017 – Nov 9, 2017

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

PATCH v2 1/1 coroutine: Fix documentation of co_aio_sleep_ns()

co_sleep_ns() was removed in commit 0b9caf9b, leaving behind a stale comment. Update the documentation to match the current usage of this function.

---
v2: instead of just blindly cribbing from Paolo's email, try to incorporate the feedback given on the wording

---
 include/qemu/coroutine.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/qemu/coroutine.h +5 -2
index 9aff9a735e..10ab50a98c 100644
@@ -262,8 +262,11 @@ void qemu_co_rwlock_unlock(CoRwlock *lock);
 /**
  * Yield the coroutine for a given duration
  *
- * Behaves similarly to co_sleep_ns(), but the sleeping coroutine will be
- * resumed when using aio_poll().
+ * This function uses timers and hence needs to know the event loop
+ * (#AioContext) to place the timer on.  After the time elapses, the
+ * current coroutine will restart with the same #AioContext it is
+ * currently running in, even if that is different than the timer
+ * context passed to co_aio_sleep_ns().
  */
 void coroutine_fn co_aio_sleep_ns(AioContext *ctx, QEMUClockType type,
                                   int64_t ns);
Signature · 1 line
2.13.6
Reviewed-by on v2 1/1
#1 lore raw
Quoted 36 lines · Eric Blake

co_sleep_ns() was removed in commit 0b9caf9b, leaving behind a stale comment. Update the documentation to match the current usage of this function.

---
v2: instead of just blindly cribbing from Paolo's email, try to incorporate the feedback given on the wording

---
 include/qemu/coroutine.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
include/qemu/coroutine.h +5 -2
index 9aff9a735e..10ab50a98c 100644
@@ -262,8 +262,11 @@ void qemu_co_rwlock_unlock(CoRwlock *lock);
 /**
  * Yield the coroutine for a given duration
  *
- * Behaves similarly to co_sleep_ns(), but the sleeping coroutine will be
- * resumed when using aio_poll().
+ * This function uses timers and hence needs to know the event loop
+ * (#AioContext) to place the timer on.  After the time elapses, the
+ * current coroutine will restart with the same #AioContext it is
+ * currently running in, even if that is different than the timer
+ * context passed to co_aio_sleep_ns().
  */
 void coroutine_fn co_aio_sleep_ns(AioContext *ctx, QEMUClockType type,
                                   int64_t ns);
Signature · 1 line
2.13.6
author
#2 lore raw
In reply to Eric Blake
Quoted 7 lines · Eric Blake

co_sleep_ns() was removed in commit 0b9caf9b, leaving behind a stale comment. Update the documentation to match the current usage of this function.

Quoted 6 lines

---
v2: instead of just blindly cribbing from Paolo's email, try to incorporate the feedback given on the wording

---
 include/qemu/coroutine.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Self-NAK; superseded by:
https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg01681.html

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org