[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [patch 1/2] qemu: sem/thread helpers
From: |
Marcelo Tosatti |
Subject: |
Re: [Qemu-devel] [patch 1/2] qemu: sem/thread helpers |
Date: |
Tue, 17 Mar 2009 20:43:44 -0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Tue, Mar 17, 2009 at 11:07:07PM +0000, Paul Brook wrote:
> On Tuesday 17 March 2009, Marcelo Tosatti wrote:
> > On Sun, Mar 15, 2009 at 04:15:52PM +0200, Avi Kivity wrote:
> > > Marcelo Tosatti wrote:
> > >> +
> > >> +struct QemuSem {
> > >> + sem_t sema;
> > >> +};
> > >
> > > Why aren't you using pthread_mutex_t?
> >
> > Because we want the thread waiting on the lock to be awakened
> > once the holder releases it. This does not happen with pthread
> > mutexes AFAIK.
>
> Really? I'd be surprised if there's any difference. The whole point of a
> mutex
> is that it blocks until the other thread releases it. At best it sounds like
> you're making fairly sketchy assumptions about the host OS scheduler
> heuristics.
Actually scratch that. Of course mutex_unlock wakes up waiters. Will
send a better patch soon.
[Qemu-devel] [patch 2/2] qemu: separate thread for io, Marcelo Tosatti, 2009/03/11