qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console


From: Jamie Lokier
Subject: Re: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console
Date: Mon, 2 Mar 2009 16:57:52 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

Anthony Liguori wrote:
> >When using the pipe as a simple semaphore all you care about is the 
> >presence or absence of data. It doesn't matter if subsequent writes loose 
> >data (e.g. by not retrying a nonblocking write) as long as a write to an 
> >empty pipe succeeds.
> 
> Yup.  You need to use a global flag to distinguish the type of signal.

If you have a set of BHs which can be scheduled from a signal handler,
set a flag in the BH when it's scheduled, prior to the non-blocking
pipe write.  The select-pipe reader can then look at all eligible BHs
looking for ones with the flag set.

If you can enqueue them in the signal handler that's even better, but
obviously beware of race conditions.

Don't forget to completely drain the pipe when reading.

Maybe use an eventfd instead of a pipe if you have eventfd. :-)

If the signal handler might be run in different threads, you'll need
to take care of memory ordering.  The flag must be set before writing
to the pipe, as observed by the pipe-reading thread.

-- Jamie




reply via email to

[Prev in Thread] Current Thread [Next in Thread]