Overhaul Windows signal handling

The new asynchronous signal delivery technique is now also being used
for tkill(), raise(), etc. Many subtle issues have been addresesd. We
now signal handling on Windows that's remarkably similar to the POSIX
behaviors. However that's just across threads. We're lacking a way to
have the signal semantics work well, across multiple WIN32 processes.
This commit is contained in:
Justine Tunney 2023-09-08 01:49:41 -07:00
parent 8bdaddd81d
commit 99dc1281f5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
38 changed files with 635 additions and 279 deletions

View file

@ -3,6 +3,7 @@
#include "libc/atomic.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/ucontext.h"
#include "libc/nt/struct/context.h"
#define __SIG_QUEUE_LENGTH 32
#define __SIG_POLLING_INTERVAL_MS 20
@ -11,6 +12,13 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct Delivery {
int ops;
int sig;
int sic;
struct NtContext *nc;
};
struct Signal {
struct Signal *next;
bool used;
@ -29,13 +37,16 @@ extern struct Signals __sig;
extern atomic_long __sig_count;
bool __sig_check(int);
bool __sig_is_core(int);
bool __sig_is_fatal(int);
bool __sig_handle(int, int, int, ucontext_t *);
int __sig_add(int, int, int);
int __sig_mask(int, const sigset_t *, sigset_t *);
int __sig_raise(int, int);
void __sig_check_ignore(const int, const unsigned);
void __sig_pending(sigset_t *);
int __sig_is_applicable(struct Signal *);
bool __sig_deliver(int, int, int, ucontext_t *);
int __sig_tramp(struct Delivery *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */