From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1So4NO-00087c-M3 for qemu-devel@nongnu.org; Sun, 08 Jul 2012 23:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1So4NM-00077n-RE for qemu-devel@nongnu.org; Sun, 08 Jul 2012 23:11:06 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:61914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1So4NM-00077G-NA for qemu-devel@nongnu.org; Sun, 08 Jul 2012 23:11:04 -0400 Received: by yhoo21 with SMTP id o21so11713209yho.4 for ; Sun, 08 Jul 2012 20:11:01 -0700 (PDT) Message-ID: <4FFA4BBA.1000800@ozlabs.ru> Date: Mon, 09 Jul 2012 13:10:50 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <4FF02F2C.30006@ozlabs.ru> <4FF05173.6090801@redhat.com> <4FF05369.20405@ozlabs.ru> <4FF062BC.4090200@ozlabs.ru> <4FF066AF.40606@redhat.com> <4FF0A980.4070903@ozlabs.ru> In-Reply-To: <4FF0A980.4070903@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] eventfd: making it rhread safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Alex Williamson , mst@redhat.com, David Gibson Ping? On 02/07/12 05:48, Alexey Kardashevskiy wrote: > QEMU uses IO handlers to run select() in the main loop. The handlers list is managed by qemu_set_fd_handler() helper which works fine when called from the main thread as it is called not when select() is waiting. > > However sometime we need to update the handlers list from another thread. For that the main loop's select() needs to be restarted with the updated list. > > The patch adds the qemu_notify_event() call to interrupt select() and make wrapping code to restart select() with the updated IO handlers list. > > Signed-off-by: Alexey Kardashevskiy > Reviewed-by: Paolo Bonzini > > --- > iohandler.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/iohandler.c b/iohandler.c > index 3c74de6..dea4355 100644 > --- a/iohandler.c > +++ b/iohandler.c > @@ -77,6 +77,7 @@ int qemu_set_fd_handler2(int fd, > ioh->fd_write = fd_write; > ioh->opaque = opaque; > ioh->deleted = 0; > + qemu_notify_event(); > } > return 0; > } > -- Alexey