[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Qemu coroutine behaviour on blocking send(3)
From: |
Iwan Budi Kusnanto |
Subject: |
Re: [Qemu-devel] Qemu coroutine behaviour on blocking send(3) |
Date: |
Fri, 28 Nov 2014 20:46:50 +0700 |
On Fri, Nov 28, 2014 at 7:47 PM, Stefan Hajnoczi <address@hidden> wrote:
> On Fri, Nov 28, 2014 at 01:55:00PM +0700, Iwan Budi Kusnanto wrote:
>> I meant, does the coroutine will do yield internally when it get
>> blocked on send(3)?
>
> No. In general, QEMU will use non-blocking file descriptors so the
> blocking case does not apply. (You can't use blocking file descriptors
> in an event loop without a risk of blocking the entire event loop.)
>
> There is qemu_co_send(), which attempts the non-blocking send(2) and
> yields on EAGAIN.
>
> block/sheepdog.c and nbd.c both use this function. It's a little ugly
> because the caller must add/remove the socket write fd handler function
> so that the coroutine is re-entered when the fd becomes writable again.
>
> Stefan
Thanks Stefan, it really helps.
--
Iwan Budi Kusnanto