summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread/pthread_private.h
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2003-01-27 22:22:30 +0000
committermarc <marc@openbsd.org>2003-01-27 22:22:30 +0000
commit083bfd4161e1542573dbc61745a708938968d40d (patch)
tree8fecc491067eed771c3b3b1059004b3d734119c9 /lib/libpthread/uthread/pthread_private.h
parentSave all floating point registers to full register sized fields, not (diff)
downloadwireguard-openbsd-083bfd4161e1542573dbc61745a708938968d40d.tar.xz
wireguard-openbsd-083bfd4161e1542573dbc61745a708938968d40d.zip
pthreads signal handling improvements. With these changes all
of the thread regressions tests pass on i386, sparc, sparc64 (save the siginfo test on sparc64 due to a kernel issue) and alpha. The tests should also pass on ppc. In addition, it fixes the problems with the "mysql torture test" provided by one of our users. The python port also appears to work correctly with these changes. Summary of changes: * check_pending removed from thread structure, no longer used. * unused elements of sigstatus structure removed. The sigstatus structure is now used to keep track of siginfo data instead of defining a local array in uthread_sig.c. * _thread_kern_sched_sig removed * _thread_sig_process goes away -- can't have a lock active when signal handlers are called. Functions now call _thread_sig_handle directly. * _thread_clear_pending now used lib wide to clear pending flags. It was named _clean_pending_flag and only used in uthread_sig.c. The function clears both per thread signals, and per process signals. * _thread_sig_handle now returns a value. * unused debugging macros removed from the thread kernel * dispatch pending signals after switching to a thread providing that signal handling hasn't been deferred by the thread. * process thread switchhooks before dispatching pending sigs * check for thread cancellation before dispatching pending sigs * re-wrote pthread-kill to do the correct thing. It now does minimal thread-kill-specific processing and then calls the existing code in uthread_sig to process the generated signal. * shut the compiler up when compiling uthread_mutex.c * no more "signal_lock". It does more harm than good. * keep track of "per-process" signals. * don't bother saving siginfo_t data for the scheduling signal. * per posix: SIGSTOP cleared when SIGCONT received and vice versa. * add _dispatch_signal to properly dispatch a signal to a thread. It sets the appropriate signal mask, something that was missing in the previous implementation. This fixes several bugs. The previous method held a lock. If the signal handler longjmp-ed the lock was never cleared and no more signals were processed.
Diffstat (limited to 'lib/libpthread/uthread/pthread_private.h')
-rw-r--r--lib/libpthread/uthread/pthread_private.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h
index 78d34b82804..cae2335ef0d 100644
--- a/lib/libpthread/uthread/pthread_private.h
+++ b/lib/libpthread/uthread/pthread_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pthread_private.h,v 1.41 2003/01/24 21:03:15 marc Exp $ */
+/* $OpenBSD: pthread_private.h,v 1.42 2003/01/27 22:22:30 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -624,7 +624,6 @@ struct pthread {
sigset_t sigmask;
sigset_t sigpend;
int sigmask_seqno;
- int check_pending;
/* Thread state: */
enum pthread_state state;
@@ -1016,14 +1015,7 @@ SCLASS volatile int _spinblock_count
/* Used to maintain pending and active signals: */
struct sigstatus {
int pending; /* Is this a pending signal? */
- int blocked; /*
- * A handler is currently active for
- * this signal; ignore subsequent
- * signals until the handler is done.
- */
- int signo; /* arg 1 to signal handler */
siginfo_t siginfo; /* arg 2 to signal handler */
- struct sigcontext uc; /* arg 3 to signal handler */
};
SCLASS struct sigstatus _thread_sigq[NSIG];
@@ -1095,11 +1087,11 @@ void _waitq_clearactive(void);
__dead void _thread_exit(const char *, int, const char *) __attribute__((__noreturn__));
void *_thread_cleanup(pthread_t);
void _thread_cleanupspecific(void);
+void _thread_clear_pending(int, pthread_t);
void _thread_dump_data(const void *, int);
void _thread_dump_info(void);
void _thread_init(void);
void _thread_kern_sched(struct sigcontext *);
-void _thread_kern_sched_sig(void);
void _thread_kern_sched_state(enum pthread_state,char *fname,int lineno);
void _thread_kern_sched_state_unlock(enum pthread_state state,
spinlock_t *lock, char *fname, int lineno);
@@ -1107,9 +1099,8 @@ void _thread_kern_set_timeout(const struct timespec *);
void _thread_kern_sig_defer(void);
void _thread_kern_sig_undefer(void);
void _thread_sig_handler(int, siginfo_t *, struct sigcontext *);
-void _thread_sig_handle(int, struct sigcontext *);
+int _thread_sig_handle(int, struct sigcontext *);
void _thread_sig_init(void);
-void _thread_sig_process(int, struct sigcontext *);
void _thread_start(void);
void _thread_start_sig_handler(void);
void _thread_seterrno(pthread_t,int);