aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-02-27 02:33:15 +0000
committerRichard M. Stallman1996-02-27 02:33:15 +0000
commit6cf0ae869df1538819550731584ebb189144d176 (patch)
tree92f469d42038759650271d42ce8d8df384228a55 /src
parent95d87237d277f33e3d30c83602af3d21a4aa64d1 (diff)
downloademacs-6cf0ae869df1538819550731584ebb189144d176.tar.gz
emacs-6cf0ae869df1538819550731584ebb189144d176.zip
(X_CONNECTION_LOCK_FLAG): New macro.
(x_connection_close_if_hung): New subroutine, at the end of the file. Include X11/Xlibint.h only for this function. #undef bcopy, bzero, bcmp, min, max first. Define malloc and free to avoid type conflicts. (x_connection_signal): Use x_connection_close_if_hung.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c62
1 files changed, 46 insertions, 16 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 70c83c65342..d0fd539bc58 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -111,8 +111,7 @@ extern void _XEditResCheckMessages ();
111#endif 111#endif
112 112
113#ifdef SOLARIS2 113#ifdef SOLARIS2
114/* For XlibDisplayWriting */ 114#define X_CONNECTION_LOCK_FLAG XlibDisplayWriting
115#include <X11/Xlibint.h>
116#endif 115#endif
117 116
118#ifndef min 117#ifndef min
@@ -4648,19 +4647,7 @@ x_connection_signal (signalnum) /* If we don't have an argument, */
4648 { 4647 {
4649 signal (SIGPIPE, x_connection_signal_1); 4648 signal (SIGPIPE, x_connection_signal_1);
4650 4649
4651#ifdef SOLARIS2 4650 x_connection_close_if_hung (x_connection_signal_dpyinfo);
4652#ifdef XlibDisplayWriting
4653 /* If the thread-interlock is locked, assume this connection is dead.
4654 This assumes that the library does not make other threads
4655 that can be locking the display legitimately. */
4656 if (x_connection_signal_dpyinfo->display->flags & XlibDisplayWriting)
4657 {
4658 x_connection_signal_dpyinfo->display->flags &= ~XlibDisplayWriting;
4659 x_connection_closed (x_connection_signal_dpyinfo->display,
4660 "connection was lost");
4661 }
4662#endif
4663#endif
4664 4651
4665 XNoOp (x_connection_signal_dpyinfo->display); 4652 XNoOp (x_connection_signal_dpyinfo->display);
4666 4653
@@ -6250,4 +6237,47 @@ syms_of_xterm ()
6250 staticpro (&Qvendor_specific_keysyms); 6237 staticpro (&Qvendor_specific_keysyms);
6251 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); 6238 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
6252} 6239}
6253#endif /* ! defined (HAVE_X_WINDOWS) */ 6240
6241/* Avoid warnings or errors from including Xlibint.h.
6242 We don't need these functions for the rest of this file. */
6243#undef bzero
6244#undef bcopy
6245#undef bcmp
6246#undef min
6247#undef max
6248
6249#ifdef X_CONNECTION_LOCK_FLAG
6250#define free loserfree
6251#define malloc losermalloc
6252/* For XlibDisplayWriting */
6253#include <X11/Xlibint.h>
6254#endif
6255
6256/* Check whether display connection DPYINFO is hung
6257 because its thread-interlock is locked.
6258 If it is, close the connection.
6259 Do nothing if this system does not have a thread interlock. */
6260
6261x_connection_close_if_hung (dpyinfo)
6262 struct x_display_info *dpyinfo;
6263{
6264 /* This tests (1) whether X_CONNECTION_LOCK_FLAG is defined at all,
6265 and (2) whether the name it is defined as is itself defined.
6266 (It ought to have been defined by Xlibint.h. */
6267#if X_CONNECTION_LOCK_FLAG
6268
6269 if (dpyinfo->display->flags & X_CONNECTION_LOCK_FLAG)
6270 {
6271 /* If the thread-interlock is locked, assume this connection is dead.
6272 This assumes that the library does not make other threads
6273 that can be locking the display legitimately. */
6274
6275 dpyinfo->display->flags &= ~X_CONNECTION_LOCK_FLAG;
6276 x_connection_closed (dpyinfo->display, "connection was lost");
6277 }
6278#endif /* X_CONNECTION_LOCK_FLAG */
6279}
6280
6281/* Don't put any additional functions here! */
6282
6283#endif /* not HAVE_X_WINDOWS */