qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] opengl rendering in the sdl window


From: Jamie Lokier
Subject: Re: [Qemu-devel] [PATCH] opengl rendering in the sdl window
Date: Mon, 8 Sep 2008 20:48:34 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Anthony Liguori wrote:
> shmget()
> shmat()
> 
> ...
> 
> notify server of key
> wait for server to confirm shmat()
> 
> ...
> 
> shmctl(IPC_RMID)
> 
> ..
> 
> shmdt()
> 
> Which leaves a huge window open where bad things can happen.  The client 
> can exit, the client can crash.  This is particularly troublesome in a 
> library because it's really not nice to try and register an atexit() 
> handler or something like that from a library.

Another way to do it, which ought to be quite reliable, is to fork()
(and maybe exec) a child helper process which calls shmget() then
prints out the ID, for the parent to read, then waits on its input.
There is also a pipe from parent to child.  If the parent closes the
pipe to child or dies, the child kills the shm ID immediately.  This
catches all kinds of parent crashing and deliberate kills, and you can
still close the pipe as soon as the parent confirms everyone is
attached to the segment.

What do Gtk and/or Qt and/or Gecko do?  They're likely to have thought
about it.

-- Jamie




reply via email to

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