#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;
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)
{