[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers
From: |
Marcelo Tosatti |
Subject: |
Re: [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers |
Date: |
Wed, 25 Mar 2009 20:29:19 -0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Wed, Mar 25, 2009 at 08:24:51PM -0300, Glauber Costa wrote:
> On Wed, Mar 25, 2009 at 7:47 PM, Marcelo Tosatti <address@hidden> wrote:
> > Signed-off-by: Marcelo Tosatti <address@hidden>
> >
> > Index: trunk/qemu-thread.c
> > ===================================================================
> > --- /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.
Sure, can be done.
> > +int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs)
> > +{
> > + int r;
> > + struct timespec ts;
> > +
> > + clock_gettime(CLOCK_REALTIME, &ts);
> > + timespec_add_ms(&ts, msecs);
> > +
> > + r = pthread_mutex_timedlock(&mutex->lock, &ts);
> > + if (r && r != ETIMEDOUT)
> > + error_exit(__func__);
> > + return 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.
There are. See patch 5.
- [Qemu-devel] [patch 00/10] iothread (candidate for inclusion), Marcelo Tosatti, 2009/03/25
- [Qemu-devel] [patch 01/10] qemu: create helper for event notification, Marcelo Tosatti, 2009/03/25
- [Qemu-devel] [patch 02/10] qemu: mutex/thread/cond wrappers, Marcelo Tosatti, 2009/03/25
- [Qemu-devel] [patch 03/10] qemu: per-arch cpu_has_work, Marcelo Tosatti, 2009/03/25
- [Qemu-devel] [patch 04/10] qemu: introduce main_loop_break, Marcelo Tosatti, 2009/03/25
- [Qemu-devel] [patch 06/10] qemu: per-cpu thread information, Marcelo Tosatti, 2009/03/25