From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmcSv-0004aM-LU for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:24:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmcSq-0004Vf-WA for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:24:57 -0400 Received: from [199.232.76.173] (port=47434 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmcSq-0004VJ-Jc for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:24:52 -0400 Received: from wf-out-1314.google.com ([209.85.200.171]:40062) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LmcSq-0005cO-73 for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:24:52 -0400 Received: by wf-out-1314.google.com with SMTP id 29so307755wff.4 for ; Wed, 25 Mar 2009 16:24:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20090325225438.835198466@amt.cnet> References: <20090325224714.853788328@amt.cnet> <20090325225438.835198466@amt.cnet> Date: Wed, 25 Mar 2009 20:24:51 -0300 Message-ID: <5d6222a80903251624p4dca8c25o6a6cea3b57c6a7e@mail.gmail.com> Subject: Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers From: Glauber Costa Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti On Wed, Mar 25, 2009 at 7:47 PM, Marcelo Tosatti wrot= e: > Signed-off-by: Marcelo Tosatti > > Index: trunk/qemu-thread.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /dev/null > +++ trunk/qemu-thread.c I think it all fits better as static inline defined in qemu-thread.h file. It'll surely generate better code. > +int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs) > +{ > + =C2=A0 =C2=A0int r; > + =C2=A0 =C2=A0struct timespec ts; > + > + =C2=A0 =C2=A0clock_gettime(CLOCK_REALTIME, &ts); > + =C2=A0 =C2=A0timespec_add_ms(&ts, msecs); > + > + =C2=A0 =C2=A0r =3D pthread_mutex_timedlock(&mutex->lock, &ts); > + =C2=A0 =C2=A0if (r && r !=3D ETIMEDOUT) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0error_exit(__func__); > + =C2=A0 =C2=A0return r; > +} Do we have in-tree users of that? Although it is a matter of personal taste= , I don't like timed locks. So if we don't have any imediate users, we might as well remove it for the sake of simplicity. --=20 Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."