void qemu_co_rwlock_unlock(CoRwlock *lock)
{
    assert(qemu_in_coroutine());
    if (lock->writer) {
        lock->writer = false;
        qemu_co_queue_restart_all(&lock->queue);
    } else {
        lock->reader--;
        assert(lock->reader >= 0);
        /* Wakeup only one waiting writer */
        if (!lock->reader) {
            qemu_co_queue_next(&lock->queue);
        }
    }
}
void qemu_co_rwlock_unlock(CoRwlock *lock)
{
    assert(qemu_in_coroutine());
    if (lock->writer) {
        lock->writer = false;
        qemu_co_queue_restart_all(&lock->queue);
    } else {
        lock->reader--;
        assert(lock->reader >= 0);
        
        if (!lock->reader) {
            qemu_co_queue_next(&lock->queue);
        }
    }
}
void FUNC_0(CoRwlock *VAR_0)
{
    assert(qemu_in_coroutine());
    if (VAR_0->writer) {
        VAR_0->writer = false;
        qemu_co_queue_restart_all(&VAR_0->queue);
    } else {
        VAR_0->reader--;
        assert(VAR_0->reader >= 0);
        
        if (!VAR_0->reader) {
            qemu_co_queue_next(&VAR_0->queue);
        }
    }
}
void FUNC_0(CoRwlock *VAR_0)
{ assert(qemu_in_coroutine()); if (VAR_0->writer) { VAR_0->writer = false; qemu_co_queue_restart_all(&VAR_0->queue); } else { VAR_0->reader--; assert(VAR_0->reader >= 0); if (!VAR_0->reader) { qemu_co_queue_next(&VAR_0->queue); } } }