Received: from [140.186.70.92] (port=45127 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKYIg-0000TC-6H for qemu-devel@nongnu.org; Fri, 04 Jun 2010 10:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKYIY-0001vZ-E2 for qemu-devel@nongnu.org; Fri, 04 Jun 2010 10:55:03 -0400 Received: from fg-out-1718.google.com ([72.14.220.153]:10419) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKYIY-0001vV-8q for qemu-devel@nongnu.org; Fri, 04 Jun 2010 10:55:02 -0400 Received: by fg-out-1718.google.com with SMTP id 16so646679fgg.10 for ; Fri, 04 Jun 2010 07:55:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4C09108F.4080004@redhat.com> References: <1275657620-26226-1-git-send-email-corentincj@iksaif.net> <1275657620-26226-3-git-send-email-corentincj@iksaif.net> <4C09108F.4080004@redhat.com> Date: Fri, 4 Jun 2010 16:55:00 +0200 Message-ID: From: Corentin Chary Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH v2 2/2] vnc: threaded VNC server List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Anthony Liguori , Gautham R Shenoy , Qemu-development List , Alexander Graf On Fri, Jun 4, 2010 at 4:41 PM, Paolo Bonzini wrote: >> + =A0 =A0vnc_lock_queue(queue); >> + =A0 =A0if (QTAILQ_EMPTY(&queue->jobs)) { >> + =A0 =A0 =A0 =A0qemu_cond_wait(&queue->cond,&queue->mutex); >> + =A0 =A0} >> + >> + =A0 =A0/* If the queue is empty, it's an exit order */ >> + =A0 =A0if (QTAILQ_EMPTY(&queue->jobs)) { >> + =A0 =A0 =A0 =A0vnc_unlock_queue(queue); >> + =A0 =A0 =A0 =A0return -1; >> + =A0 =A0} >> + >> + =A0 =A0job =3D QTAILQ_FIRST(&queue->jobs); >> + =A0 =A0vnc_unlock_queue(queue); > > Wrong usage of condition variables... Because it's not in a loop ? Like I said in the cover-letter (but this should probably be in a comment here) you can't use multiple worker on a single queue because of zlib streams. But if the issue is more a style issue than the actual implementation, then I can use a loop and an exit flag. >> + =A0 =A0flush =3D (job->vs->csock !=3D -1&& =A0job->vs->abording !=3D t= rue); > > and typo still there. Ooops, I did it again. >> +static void *vnc_worker_thread(void *arg) >> +{ >> + =A0 =A0VncJobQueue *queue =3D arg; > > Also, it's better (future proof) to call qemu_thread_self here. Ok, --=20 Corentin Chary http://xf.iksaif.net