Mail Archives: djgpp-workers/1998/03/22/08:55:38
Somebody complained about `sigpending' being on the same object module
as `sigprocmask'; allegedly, this makes problems for some threading
package.
I don't really understand how come `sigpending' is not thread-safe
while `sigprocmask' is, but since I'm responsible for that unholy
marriage, here's the divorce:
*** src/libc/posix/signal/sigprocm.c~0 Sun Aug 31 17:07:16 1997
--- src/libc/posix/signal/sigprocm.c Fri Mar 20 19:38:56 1998
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <libc/stubs.h>
*************** static int sigprocmask_count = -1;
*** 12,18 ****
static sigset_t current_mask;
/* Which signals are pending (initially none). */
! static sigset_t pending_signals;
/* Previous handlers to restore when the blocked signals are unblocked. */
typedef void (*sighandler_t)(int);
--- 13,19 ----
static sigset_t current_mask;
/* Which signals are pending (initially none). */
! sigset_t __sigprocmask_pending_signals;
/* Previous handlers to restore when the blocked signals are unblocked. */
typedef void (*sighandler_t)(int);
*************** static sighandler_t prev_handlers[SIGMAX
*** 23,29 ****
static void
sig_suspender (int signo)
{
! sigaddset (&pending_signals, signo);
}
int
--- 24,30 ----
static void
sig_suspender (int signo)
{
! sigaddset (&__sigprocmask_pending_signals, signo);
}
int
*************** sigprocmask (int how, const sigset_t *ne
*** 36,42 ****
if (sigprocmask_count != __bss_count)
{
sigprocmask_count = __bss_count;
! sigemptyset (&pending_signals);
sigemptyset (¤t_mask);
for (signo = 0; signo < SIGMAX; signo++)
prev_handlers[signo] = SIG_ERR;
--- 37,43 ----
if (sigprocmask_count != __bss_count)
{
sigprocmask_count = __bss_count;
! sigemptyset (&__sigprocmask_pending_signals);
sigemptyset (¤t_mask);
for (signo = 0; signo < SIGMAX; signo++)
prev_handlers[signo] = SIG_ERR;
*************** sigprocmask (int how, const sigset_t *ne
*** 81,107 ****
signal (signo, prev_handlers[signo]);
prev_handlers[signo] = SIG_ERR;
}
! if (sigismember (&pending_signals, signo))
{
! sigdelset (&pending_signals, signo);
raise (signo);
}
}
}
current_mask = new_mask;
- return 0;
- }
-
- int
- sigpending(sigset_t *set)
- {
- if (set == (sigset_t *)0)
- {
- errno = EFAULT;
- return -1;
- }
-
- *set = pending_signals;
return 0;
}
--- 82,95 ----
signal (signo, prev_handlers[signo]);
prev_handlers[signo] = SIG_ERR;
}
! if (sigismember (&__sigprocmask_pending_signals, signo))
{
! sigdelset (&__sigprocmask_pending_signals, signo);
raise (signo);
}
}
}
current_mask = new_mask;
return 0;
}
*** /dev/null Fri Mar 20 19:43:48 1998
--- src/libc/posix/signal/sigpendi.c Fri Mar 20 19:39:00 1998
***************
*** 0 ****
--- 1,19 ----
+ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
+ #include <libc/stubs.h>
+ #include <signal.h>
+ #include <errno.h>
+
+ extern sigset_t __sigprocmask_pending_signals;
+
+ int
+ sigpending(sigset_t *set)
+ {
+ if (set == (sigset_t *)0)
+ {
+ errno = EFAULT;
+ return -1;
+ }
+
+ *set = __sigprocmask_pending_signals;
+ return 0;
+ }
*** src/libc/posix/signal/makefile.~0 Sun Aug 31 21:20:34 1997
--- src/libc/posix/signal/makefile Fri Mar 20 19:41:54 1998
*************** SRC += sigempty.c
*** 10,15 ****
--- 10,16 ----
SRC += sigfills.c
SRC += sigismem.c
SRC += sigprocm.c
+ SRC += sigpendi.c
SRC += sigsuspe.c
include $(TOP)/../makefile.inc
- Raw text -