RUS (Daniela.Rainer++at++RUS.Uni-Stuttgart.DE)
Thu, 29 Oct 1998 17:11:33 +0000
I want to do X event handling in a Performer application (I don't want to use
pfu...). I do not fork an extra process for X but I need multiprocessing.
I wrote a very simple program, it's attached to this email. It looks very
similar to hlcube.c.
Could anybody tell me why it runs fine in singleprocessing (PFMP_APPCULLDRAW)
and crashes in multiprocessing (PFMP_APP_CULLDRAW)? The solution must be very
simple but I don't see it at the moment.
Thanks for any help!
Best Regards
Daniela
-- ------------------------------------------------------------------------- Daniela Rainer | email: rainer++at++hlrs.de Rechenzentrum Uni Stuttgart (RUS) | http://www.hlrs.de/people/rainer/ Allmandring 30a, 70550 Stuttgart | Tel: +49 (0) 711 685 5837 GERMANY | Fax: +49 (0) 711 682 357
/************************************************************************/ /* */ /* Simple program showing my problems with X event handling */ /* in multiprocess mode */ /* */ /* cc -o simple simple.c -lpf_ogl */ /* -lmpc -limage -lfm -lGLU -lGL */ /* -lm -lXm -lXt -lfpe -lXmu -lX11 */ /* */ /************************************************************************/
#include <stdlib.h> #include <stdio.h> #include <math.h>
#include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h>
#define PF_CPLUSPLUS_API 0 #include <Performer/pf.h> #include <Performer/pr.h>
int main(int argc, char *argv[]) { pfScene *scene; pfPipe *pipe; pfPipeWindow *pwin; pfChannel *chan; pfWSWindow xwin; Display *xdisplay; XEvent event;
pfInit();
/* the program runs fine with PFMP_APPCULLDRAW but crashes with PFMP_APP_CULLDRAW */ pfMultiprocess(PFMP_APPCULLDRAW); pfConfig();
scene = pfNewScene();
pipe = pfGetPipe(0); pwin = pfNewPWin(pipe); pfPWinOriginSize(pwin, 100, 100, 400, 400); pfPWinType(pwin, PFPWIN_TYPE_X); pfConfigPWin(pwin); pfFrame();
chan = pfNewChan(pfGetPipe(0)); pfMakeSimpleChan(chan,45.0f); pfChanScene(chan, scene);
xwin = pfGetPWinWSWindow(pwin); xdisplay = pfGetCurWSConnection(); XSelectInput(xdisplay, xwin, KeyPressMask); XMapWindow(xdisplay, xwin);
while (1) { pfSync();
pfFrame(); while (XPending(xdisplay)) { XNextEvent(xdisplay, &event); switch (event.type) { case KeyPress: fprintf(stderr,"Key Press Event !\n"); } } } }
This archive was generated by hypermail 2.0b2 on Thu Oct 29 1998 - 08:11:45 PST