QSLIST_ENTRY(Coroutine) pool_next;
/* Coroutines that should be woken up when we yield or terminate */
- QTAILQ_HEAD(, Coroutine) co_queue_wakeup;
- QTAILQ_ENTRY(Coroutine) co_queue_next;
+ QSIMPLEQ_HEAD(, Coroutine) co_queue_wakeup;
+ QSIMPLEQ_ENTRY(Coroutine) co_queue_next;
};
Coroutine *qemu_coroutine_new(void);
void qemu_co_queue_init(CoQueue *queue)
{
- QTAILQ_INIT(&queue->entries);
+ QSIMPLEQ_INIT(&queue->entries);
}
void coroutine_fn qemu_co_queue_wait(CoQueue *queue)
{
Coroutine *self = qemu_coroutine_self();
- QTAILQ_INSERT_TAIL(&queue->entries, self, co_queue_next);
+ QSIMPLEQ_INSERT_TAIL(&queue->entries, self, co_queue_next);
qemu_coroutine_yield();
assert(qemu_in_coroutine());
}
Coroutine *next;
trace_qemu_co_queue_run_restart(co);
- while ((next = QTAILQ_FIRST(&co->co_queue_wakeup))) {
- QTAILQ_REMOVE(&co->co_queue_wakeup, next, co_queue_next);
+ while ((next = QSIMPLEQ_FIRST(&co->co_queue_wakeup))) {
+ QSIMPLEQ_REMOVE_HEAD(&co->co_queue_wakeup, co_queue_next);
qemu_coroutine_enter(next, NULL);
}
}
Coroutine *self = qemu_coroutine_self();
Coroutine *next;
- if (QTAILQ_EMPTY(&queue->entries)) {
+ if (QSIMPLEQ_EMPTY(&queue->entries)) {
return false;
}
- while ((next = QTAILQ_FIRST(&queue->entries)) != NULL) {
- QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
- QTAILQ_INSERT_TAIL(&self->co_queue_wakeup, next, co_queue_next);
+ while ((next = QSIMPLEQ_FIRST(&queue->entries)) != NULL) {
+ QSIMPLEQ_REMOVE_HEAD(&queue->entries, co_queue_next);
+ QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, next, co_queue_next);
trace_qemu_co_queue_next(next);
if (single) {
break;
{
Coroutine *next;
- next = QTAILQ_FIRST(&queue->entries);
+ next = QSIMPLEQ_FIRST(&queue->entries);
if (!next) {
return false;
}
- QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
+ QSIMPLEQ_REMOVE_HEAD(&queue->entries, co_queue_next);
qemu_coroutine_enter(next, NULL);
return true;
}
bool qemu_co_queue_empty(CoQueue *queue)
{
- return QTAILQ_FIRST(&queue->entries) == NULL;
+ return QSIMPLEQ_FIRST(&queue->entries) == NULL;
}
void qemu_co_mutex_init(CoMutex *mutex)