Re: IO error catching



There is no way with Xlib to recover from a IO error. Period.

       The XSetIOErrorHandler sets the fatal I/O error handler.
       Xlib calls the program's supplied error handler if any
       sort of system call error occurs (for example, the connec­
       tion to the server was lost).  This is assumed to be a
       fatal condition, and the called routine should not return.
       If the I/O error handler does return, the client process
       exits.

Xlib internals would most likely be left in an inconsistent state if
you long-jumped out. Using two processes as David Helder suggested
would be the best way to handle things.

Regards,
                                        Owen

Erwin Rol <Erwin Rol q-soft-engineering com> writes:

> Hello All,
> 
> Is there a way to return from the main loop in case of a "fatal"
> IO error (for example the X-Server died). And after that return
> being able to (try) reconnect to the X-Server again. I am thinking about
> and application where there are two computers, one with the programm
> that 
> always runs, and one with the X-Server that doesn't always runs. Both
> computers are connected via cross over with known IP numbers. The one
> with the X-Server has just the X-Server and nothing else as it is turned
> on it starts the X-Server, nothing else. The programm runnign on the
> other
> computer detects the X-Server and connects. When the computer with
> the X-Server is turned off, the programm on the other computer should
> not die
> but keep running and keep retrying to connect to the X-Server. 
> 
> I though somethign like a longjmp from the error handler to the mainloop
> and
> exit from the loop. The main problem is probably clean up without
> getting into
> a endless error loop, or having memory leaks. 
> 
> Any hints, "you are an idiot" msgs, or quiestions are welcome,




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