changeset 14305:3cc44eaf9ebf

(x_connection_signal): Explicitly check the thread interlock on Solaris. [SOLARIS2]: Include Xlibint.h. (x_connection_signal): Access XlibDisplayWriting properly. No need to sleep--if the flag is set, assume connection is dead.
author Karl Heuer <kwzh@gnu.org>
date Wed, 24 Jan 1996 23:43:22 +0000
parents 57194b6a555d
children b30429f0b599
files src/xterm.c
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Wed Jan 24 23:42:32 1996 +0000
+++ b/src/xterm.c	Wed Jan 24 23:43:22 1996 +0000
@@ -110,6 +110,11 @@
 #include <locale.h>
 #endif
 
+#ifdef SOLARIS2
+/* For XlibDisplayWriting */
+#include <X11/Xlibint.h>
+#endif
+
 #define min(a,b) ((a)<(b) ? (a) : (b))
 #define max(a,b) ((a)>(b) ? (a) : (b))
 
@@ -4632,15 +4637,18 @@
       signal (SIGPIPE, x_connection_signal_1);
       signal (SIGALRM, x_connection_signal_1);
 
-      /* According to Jim Campbell <jec@murzim.ca.boeing.com>,
-	 On Solaris 2.4, XNoOp can hang when the connection
-	 has already died.  Since XNoOp should not wait,
-	 let's assume that if it hangs for 3 seconds
-	 that means the connection is dead.
-	 This is a kludge, but I don't see any other way that works.  */
-      alarm (3);
+#ifdef SOLARIS2
+#ifdef XlibDisplayWriting
+      /* If the thread-interlock is locked, assume this connection is dead.
+	 This assumes that the library does not make other threads
+	 that can be locking the display legitimately.  */
+      if (x_connection_signal_dpyinfo->display->flags & XlibDisplayWriting)
+	x_connection_closed (x_connection_signal_dpyinfo,
+			     "connection was lost");
+#endif
+#endif
+
       XNoOp (x_connection_signal_dpyinfo->display);
-      alarm (0);
 
       XSync (x_connection_signal_dpyinfo->display, False);