RE: IO error catching



The way I've seen this done in the past is as others have suggested
already... Start a parent program that spawns the gtk program as a child.
When the child dies due to loss of connection to the X server, the parent
can continue to restart the child or monitor the X server and then restart
the child.

Believe it or not, this has been done before.

David

-----Original Message-----
From: gtk-devel-list-admin gnome org
[mailto:gtk-devel-list-admin gnome org]On Behalf Of Erwin Rol
Sent: Tuesday, December 12, 2000 12:21 PM
To: Owen Taylor
Cc: gtk-devel-list gnome org
Subject: Re: IO error catching


Owen Taylor wrote:
>
> 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.

Yeah i read that part, and i very much disliked it very much :-/

>
> 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.

Yeah you are problably right, i think it is a rather serious design flaw
(of Xlib
not GTK+ ) though, when a library forces you to exit your programm
because it is
not able to handle a error in a good way.

It would be very nice when GTK+ had some way to register Error handlers
though,
unless using Xlib functions is recommended practice.

Oh well i will keep trying, cause
for every solution there is a problem :-)

- Erwin


>
> 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,
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list





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