*
* ---------------------------------------------------------------------------*/
-/* This is non-Posix-compliant.
- #include "PosixSource.h"
-*/
+#include "PosixSource.h"
#include "Rts.h"
-#include "SchedAPI.h"
+
#include "Schedule.h"
#include "RtsSignals.h"
-#include "posix/Signals.h"
+#include "Signals.h"
#include "RtsUtils.h"
-#include "RtsFlags.h"
#include "Prelude.h"
-#include "ThrIOManager.h"
+#include "Stable.h"
#ifdef alpha_HOST_ARCH
# if defined(linux_HOST_OS)
#define IO_MANAGER_WAKEUP 0xff
#define IO_MANAGER_DIE 0xfe
+#define IO_MANAGER_SYNC 0xfd
void
setIOManagerPipe (int fd)
{
// only called when THREADED_RTS, but unconditionally
// compiled here because GHC.Conc depends on it.
- if (io_manager_pipe < 0) {
- io_manager_pipe = fd;
- }
+ io_manager_pipe = fd;
}
-#if defined(THREADED_RTS)
void
ioManagerWakeup (void)
{
}
void
+ioManagerSync (void)
+{
+ int r;
+ // Wake up the IO Manager thread by sending a byte down its pipe
+ if (io_manager_pipe >= 0) {
+ StgWord8 byte = (StgWord8)IO_MANAGER_SYNC;
+ r = write(io_manager_pipe, &byte, 1);
+ if (r == -1) { sysErrorBelch("ioManagerSync: write"); }
+ }
+}
+
+#if defined(THREADED_RTS)
+void
ioManagerDie (void)
{
int r;
}
}
+Capability *
+ioManagerStartCap (Capability *cap)
+{
+ return rts_evalIO(cap,&base_GHCziConc_ensureIOManagerIsRunning_closure,NULL);
+}
+
void
ioManagerStart (void)
{
Capability *cap;
if (io_manager_pipe < 0) {
cap = rts_lock();
- cap = rts_evalIO(cap,&base_GHCziConc_ensureIOManagerIsRunning_closure,NULL);
+ cap = ioManagerStartCap(cap);
rts_unlock(cap);
}
}
int r;
buf[0] = sig;
- memcpy(buf+1, info, sizeof(siginfo_t));
+
+ if (info == NULL) {
+ // info may be NULL on Solaris (see #3790)
+ memset(buf+1, 0, sizeof(siginfo_t));
+ } else {
+ memcpy(buf+1, info, sizeof(siginfo_t));
+ }
+
r = write(io_manager_pipe, buf, sizeof(siginfo_t)+1);
if (r == -1 && errno == EAGAIN)
{