[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock
From: |
Charlie Shepherd |
Subject: |
[Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock |
Date: |
Fri, 9 Aug 2013 19:44:04 +0200 |
qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock can only run in a coroutine
context, so annotate them with coroutine_fn.
Signed-off-by: Charlie Shepherd <address@hidden>
---
include/block/coroutine.h | 4 ++--
qemu-coroutine-lock.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/block/coroutine.h b/include/block/coroutine.h
index 1aae6e9..5e73219 100644
--- a/include/block/coroutine.h
+++ b/include/block/coroutine.h
@@ -199,14 +199,14 @@ void qemu_co_rwlock_init(CoRwlock *lock);
* of a parallel writer, control is transferred to the caller of the current
* coroutine.
*/
-void qemu_co_rwlock_rdlock(CoRwlock *lock);
+void coroutine_fn qemu_co_rwlock_rdlock(CoRwlock *lock);
/**
* Write Locks the mutex. If the lock cannot be taken immediately because
* of a parallel reader, control is transferred to the caller of the current
* coroutine.
*/
-void qemu_co_rwlock_wrlock(CoRwlock *lock);
+void coroutine_fn qemu_co_rwlock_wrlock(CoRwlock *lock);
/**
* Unlocks the read/write lock and schedules the next coroutine that was
diff --git a/qemu-coroutine-lock.c b/qemu-coroutine-lock.c
index aeb33b9..06ee5b9 100644
--- a/qemu-coroutine-lock.c
+++ b/qemu-coroutine-lock.c
@@ -161,7 +161,7 @@ void qemu_co_rwlock_init(CoRwlock *lock)
qemu_co_queue_init(&lock->queue);
}
-void qemu_co_rwlock_rdlock(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_rdlock(CoRwlock *lock)
{
while (lock->writer) {
qemu_co_queue_wait(&lock->queue);
@@ -185,7 +185,7 @@ void qemu_co_rwlock_unlock(CoRwlock *lock)
}
}
-void qemu_co_rwlock_wrlock(CoRwlock *lock)
+void coroutine_fn qemu_co_rwlock_wrlock(CoRwlock *lock)
{
while (lock->writer || lock->reader) {
qemu_co_queue_wait(&lock->queue);
--
1.8.3.2
- [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions, (continued)
- [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 09/15] Add a synchronous wrapper bdrv_sync_rwco, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 11/15] Make bdrv_discard coroutine only and add bdrv_sync_discard, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 12/15] Make bdrv_flush coroutine only and add bdrv_sync_flush, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 10/15] Convert bdrv_read, bdrv_write and associated functions to coroutine functions, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 13/15] Introduce a run_handler function in qemu-img.c, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 15/15] Add coroutine_fn annotations to nbd_co_* functions., Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock,
Charlie Shepherd <=
- Re: [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn, Stefan Hajnoczi, 2013/08/14
- Re: [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn, Stefan Hajnoczi, 2013/08/29