On Mon, Jul 02, 2012 at 11:30:13PM -0700, Keith Packard wrote:
> Peter Hutterer <[email protected]> writes:
>
> > void
> > OsReleaseSignals(void)
> > {
> > #ifdef SIG_BLOCK
> > if (--BlockedSignalCount == 0) {
> > sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0);
> > + OsReleaseSIGIO();
> > }
> > #endif
>
> Should you use SIG_UNBLOCK instead of SIG_SETMASK? It took me several
> minutes to figure out that SIG_SETMASK will work because
> PreviousSignalMask *always* contains SIGIO as it is set after
> the call to OsBlockSIGIO in OsBlockSignals. Either that, or a comment
> explaining why this works so future-me doesn't get confused again...
We'd have to mask out SIGIO from PrevSignalMask then for SIG_UNBLOCK to
work:
diff --git a/os/utils.c b/os/utils.c
index 55f58b9..0f6419c 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1179,6 +1179,11 @@ OsBlockSignals(void)
sigaddset(&set, SIGTTOU);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, &PreviousSignalMask);
+
+#ifdef SIGIO
+ /* OsBlockSIGIO is in charge of SIGIO*/
+ sigdelset(&PreviousSignalMask, SIGIO);
+#endif
}
#endif
}
@@ -1235,7 +1240,7 @@ OsReleaseSignals(void)
{
#ifdef SIG_BLOCK
if (--BlockedSignalCount == 0) {
- sigprocmask(SIG_SETMASK, &PreviousSignalMask, 0);
+ sigprocmask(SIG_UNBLOCK, &PreviousSignalMask, 0);
OsReleaseSIGIO();
}
#endif
Works for for me too, whichever you prefer.
Cheers,
Peter
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel