[Bf-committers] Ghost and fork()

Alexander Ewering bf-committers@blender.org
Sun, 7 Sep 2003 18:27:45 +0200 (CEST)


I'm currently working on implementing a global multi-level UNDO
feature (in addition to the already implemented editmode undo).

For this, I'm following a suggestion from an ex-NaNer: For
every operation that should be un-doable, just fork() and put
the new child asleep (until it is awoken by a signal).
When the user wants undo, the current process awakes the appropriate
child (using a signal) and puts itself to sleep (using an endless
loop in the style while (waiting) { PIL_sleep_ms(10); }, where
"waiting" is set to 0 by a signal handler).

This basically works fairly well, but there seem to be some
OpenGL and X11-related problems.

Sometimes, the 'active' process just hangs for a few seconds,
CPU goes to 100%, and then it just continues with no problems.

Also, sometimes an X11 error similar to this appears:

Bad ID in request: X_CreateGlyphCursor


Xlib: invalid async request (0xabc)

Can anyone with more experience on Ghost / X11 give me any
hints on what exactly I should do when a process awakes or is
put to sleep? How should it reclaim / free X11/OpenGL/GHOST

Many thanks.

| alexander ewering           instinctive new media
| ae@instinctive.de       http://www.instinctive.de 
| fon: +49-2393-220558         fax: +49-2393-220559