public inbox for cygwin-xfree@sourceware.org help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk> To: cygwin-xfree@cygwin.com Cc: Jon TURNEY <jon.turney@dronecode.org.uk> Subject: [PATCH 2/2] Cygwin/X: Cause the X server to terminate if clipboard or WM internal client threads exit due to an error Date: Thu, 01 Oct 2009 12:12:00 -0000 [thread overview] Message-ID: <1254399169-2412-3-git-send-email-jon.turney@dronecode.org.uk> (raw) In-Reply-To: <1254399169-2412-2-git-send-email-jon.turney@dronecode.org.uk> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> --- hw/xwin/winclipboardthread.c | 17 +++++++++++++++++ hw/xwin/winmultiwindowwm.c | 22 +++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletions(-) diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c index fefd408..962d9d6 100644 --- a/hw/xwin/winclipboardthread.c +++ b/hw/xwin/winclipboardthread.c @@ -84,6 +84,8 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr); static int winClipboardIOErrorHandler (Display *pDisplay); +static void +winClipboardThreadExit(void *arg); /* * Main thread function @@ -110,6 +112,8 @@ winClipboardProc (void *pvNotUsed) char szDisplay[512]; int iSelectError; + pthread_cleanup_push(&winClipboardThreadExit, NULL); + ErrorF ("winClipboardProc - Hello\n"); /* Do we have Unicode support? */ @@ -434,6 +438,8 @@ winClipboardProc (void *pvNotUsed) g_pClipboardDisplay = NULL; g_hwndClipboard = NULL; + pthread_cleanup_pop(0); + return NULL; } @@ -475,3 +481,14 @@ winClipboardIOErrorHandler (Display *pDisplay) return 0; } + +/* + * winClipboardThreadExit - Thread exit handler + */ + +static void +winClipboardThreadExit(void *arg) +{ + /* clipboard thread has exited, stop server as well */ + kill(getpid(), SIGTERM); +} diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 0de607d..87cb3dc 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -180,6 +180,9 @@ winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr); static int winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay); +static void +winMultiWindowThreadExit(void *arg); + static int winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr); @@ -637,6 +640,8 @@ winMultiWindowWMProc (void *pArg) { WMProcArgPtr pProcArg = (WMProcArgPtr)pArg; WMInfoPtr pWMInfo = pProcArg->pWMInfo; + + pthread_cleanup_push(&winMultiWindowThreadExit, NULL); /* Initialize the Window Manager */ winInitMultiWindowWM (pWMInfo, pProcArg); @@ -849,6 +854,9 @@ winMultiWindowWMProc (void *pArg) #if CYGMULTIWINDOW_DEBUG ErrorF("-winMultiWindowWMProc ()\n"); #endif + + pthread_cleanup_pop(0); + return NULL; } @@ -871,6 +879,8 @@ winMultiWindowXMsgProc (void *pArg) int iReturn; XIconSize *xis; + pthread_cleanup_push(&winMultiWindowThreadExit, NULL); + ErrorF ("winMultiWindowXMsgProc - Hello\n"); /* Check that argument pointer is not invalid */ @@ -1108,7 +1118,7 @@ winMultiWindowXMsgProc (void *pArg) } XCloseDisplay (pProcArg->pDisplay); - pthread_exit (NULL); + pthread_cleanup_pop(0); return NULL; } @@ -1428,6 +1438,16 @@ winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay) return 0; } +/* + * winMultiWindowThreadExit - Thread exit handler + */ + +static void +winMultiWindowThreadExit(void *arg) +{ + /* multiwindow client thread has exited, stop server as well */ + kill(getpid(), SIGTERM); +} /* * Catch RedirectError to detect other window manager running -- 1.6.4.2 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/
next prev parent reply other threads:[~2009-10-01 12:12 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-10-01 12:12 [PATCH 0/2] Patches to improve some edge cases in internal client connections Jon TURNEY 2009-10-01 12:12 ` [PATCH 1/2] Cygwin/X: Improve choice of display name used by internal clients Jon TURNEY 2009-10-01 12:12 ` Jon TURNEY [this message] 2009-10-07 2:16 ` Yaakov (Cygwin/X) 2009-10-11 19:13 ` Jon TURNEY
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1254399169-2412-3-git-send-email-jon.turney@dronecode.org.uk \ --to=jon.turney@dronecode.org.uk \ --cc=cygwin-xfree@cygwin.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).