X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsUtils.c;h=f4d61b1992dda014b9b080402d8738375f9ca85b;hb=20d697a1c300663df2c1472e222e57c84c4385fc;hp=89a8af1e667842e284288a42c2b6a95b5f2e7332;hpb=1749c26268dc04363409d996d3836db0ce74f438;p=ghc-hetmet.git diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index 89a8af1..f4d61b1 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -32,6 +32,15 @@ #include #include +#if defined(openbsd_TARGET_OS) +# ifdef HAVE_SIGNAL_H +# include +# endif +# ifdef HAVE_PTHREAD_H +# include +# endif +#endif + /* ----------------------------------------------------------------------------- Result-checking malloc wrappers. -------------------------------------------------------------------------- */ @@ -288,3 +297,19 @@ heapCheckFail( void ) } #endif +/* + * It seems that pthreads and signals interact oddly in OpenBSD + * pthreads (and possibly FreeBSD). When linking with -lpthreads, we + * have to use pthread_kill to send blockable signals. So use that + * when we have a threaded rts. So System.Posix.Signals will call + * genericRaise(), rather than raise(3). + */ +#if defined(openbsd_TARGET_OS) +int genericRaise(int sig) { +# if defined(THREADED_RTS) + return pthread_kill(pthread_self(), sig); +# else + return raise(sig); +# endif +} +#endif