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

Re: Problems with XOpenDisplay



Here's what our current VM does (in xlibPrims.c):

  Display* XOpenDisplay_wrap(char *name, void *FH) {
    // XOpenDisplay fails if a signal is received during the call.
    // All signals except user interrupts are therefore blocked. 
    SignalBlocker sb(true);
    
    Display* result = XOpenDisplay(name);
    if (result == 0)  {
      prim_failure(FH, PRIMITIVEFAILEDERROR);
      return result;
    }

    XSetErrorHandler(xErrorHandler);
    XSetIOErrorHandler(xIOErrorHandler);

    // add this file descriptor to list of all open files
    FD_SET(ConnectionNumber(result), &activeFDs);
    return result;
  }

The SignalBlocker blocks all signals except user interrupts (see
abort.h) (yes, we're using SIGVTALARM and SIGIO as well).

This definitely improves things, but sometimes it still fails.  Don't
ask me why.

-Urs