From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmcXS-0002Xn-W6 for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:29:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmcXO-0002RO-8v for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:29:38 -0400 Received: from [199.232.76.173] (port=39786 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmcXO-0002R4-4B for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:29:34 -0400 Received: from mx2.redhat.com ([66.187.237.31]:40227) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LmcXM-0006kY-Uk for qemu-devel@nongnu.org; Wed, 25 Mar 2009 19:29:33 -0400 Date: Wed, 25 Mar 2009 20:29:19 -0300 From: Marcelo Tosatti Subject: Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers Message-ID: <20090325232919.GB5335@amt.cnet> References: <20090325224714.853788328@amt.cnet> <20090325225438.835198466@amt.cnet> <5d6222a80903251624p4dca8c25o6a6cea3b57c6a7e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <5d6222a80903251624p4dca8c25o6a6cea3b57c6a7e@mail.gmail.com> 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: Glauber Costa Cc: qemu-devel@nongnu.org On Wed, Mar 25, 2009 at 08:24:51PM -0300, Glauber Costa wrote: > On Wed, Mar 25, 2009 at 7:47 PM, Marcelo Tosatti = wrote: > > 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 fi= le. > It'll surely generate better code. Sure, can be done. > > +int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs) > > +{ > > + =A0 =A0int r; > > + =A0 =A0struct timespec ts; > > + > > + =A0 =A0clock_gettime(CLOCK_REALTIME, &ts); > > + =A0 =A0timespec_add_ms(&ts, msecs); > > + > > + =A0 =A0r =3D pthread_mutex_timedlock(&mutex->lock, &ts); > > + =A0 =A0if (r && r !=3D ETIMEDOUT) > > + =A0 =A0 =A0 =A0error_exit(__func__); > > + =A0 =A0return r; > > +} >=20 > Do we have in-tree users of that? Although it is a matter of personal t= aste, > 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. There are. See patch 5.