aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-06 09:12:35 +0200
committermarha <marha@users.sourceforge.net>2012-07-06 09:13:41 +0200
commit336bad93d146931c160d8517edfdf0bee49ad9f7 (patch)
treed0fbdb5a716e78aa6318c7ddd49bd3e09e13379f /xorg-server/os
parentfc8f37239f3af088819c18f5632b2608954af73a (diff)
downloadvcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.gz
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.tar.bz2
vcxsrv-336bad93d146931c160d8517edfdf0bee49ad9f7.zip
randrproto fontconfig mesa xserver git update 6 Jul 2012
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/utils.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 998c3ed4a..253793467 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -1167,15 +1167,15 @@ OsBlockSignals(void)
if (BlockedSignalCount++ == 0) {
sigset_t set;
+#ifdef SIGIO
+ OsBlockSIGIO();
+#endif
sigemptyset(&set);
sigaddset(&set, SIGALRM);
sigaddset(&set, SIGVTALRM);
#ifdef SIGWINCH
sigaddset(&set, SIGWINCH);
#endif
-#ifdef SIGIO
- sigaddset(&set, SIGIO);
-#endif
sigaddset(&set, SIGTSTP);
sigaddset(&set, SIGTTIN);
sigaddset(&set, SIGTTOU);
@@ -1185,12 +1185,60 @@ OsBlockSignals(void)
#endif
}
+#ifdef SIG_BLOCK
+static sig_atomic_t sigio_blocked;
+#endif
+
+/**
+ * returns zero if this call caused SIGIO to be blocked now, non-zero if it
+ * was already blocked by a previous call to this function.
+ */
+int
+OsBlockSIGIO(void)
+{
+#ifdef SIGIO
+#ifdef SIG_BLOCK
+ if (sigio_blocked++ == 0) {
+ sigset_t set, old;
+ int ret;
+
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_BLOCK, &set, &old);
+ ret = sigismember(&old, SIGIO);
+ return ret;
+ } else
+ return 1;
+#endif
+#endif
+}
+
+void
+OsReleaseSIGIO(void)
+{
+#ifdef SIGIO
+#ifdef SIG_BLOCK
+ if (--sigio_blocked == 0) {
+ sigset_t set;
+
+ sigemptyset(&set);
+ sigaddset(&set, SIGIO);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
+ } else if (sigio_blocked < 0) {
+ BUG_WARN(sigio_blocked < 0);
+ sigio_blocked = 0;
+ }
+#endif
+#endif
+}
+
void
OsReleaseSignals(void)
{
#ifdef SIG_BLOCK
if (--BlockedSignalCount == 0) {
sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0);
+ OsReleaseSIGIO();
}
#endif
}