IO Error Handling In Threads

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

1 post / 0 new
IO Error Handling In Threads


Hi Everyone,

I noticed that an X lib IO error causes the process to exit. I believe the default X lib IO handler calls 'exit' where then the entire process goes down.

I realize it is possible to set your own handler to handle X lib IO errors with a call to XSetIOErrorHandler. However, still, after calling my own X lib IO error handler, the process still exits.

My issue is this:

What if I create a thread that makes a connection to a Remote X server where the cable to the X server is suddenly cut. I would get the following error:

"XIO: fatal IO error 110 (Connection timed out) on X server ""
after 151 requests (151 known processed) with 0 events remaining.

In such a case, I would like my thread to die off. Instead, my entire process dies off. So, if I had 4 threads in 1 process that has X connections to their corresponding X servers and ONE of the X servers goes down for that thread (broken connection), the entire process (which includes the other 3 threads with their own X connection) goes down too with the entire process exiting. Doesn't seem very friendly!

Is there a way to prohibit 'exit' from being called? Or what are workarounds for this?