summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2014-08-22 08:51:38 -0500
committerAustin Seipp <austin@well-typed.com>2014-08-22 08:52:13 -0500
commit4748f5936fe72d96edfa17b153dbfd84f2c4c053 (patch)
treeed5ad9f4fda46023a74010ecce38e3b47e17959b /rts
parent22520cd7071e624cb3cbde6fdd65e872855dd6ff (diff)
downloadhaskell-4748f5936fe72d96edfa17b153dbfd84f2c4c053.tar.gz
Revert "rts/base: Fix #9423"
This should fix the Windows fallout, and hopefully this will be fixed once that's sorted out. This reverts commit f9f89b7884ccc8ee5047cf4fffdf2b36df6832df. Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'rts')
-rw-r--r--rts/Capability.c11
-rw-r--r--rts/Capability.h3
-rw-r--r--rts/Linker.c1
-rw-r--r--rts/posix/Signals.c80
4 files changed, 30 insertions, 65 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index 04f3a61993..fda9f4f278 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -256,7 +256,6 @@ initCapability( Capability *cap, nat i )
cap->spark_stats.converted = 0;
cap->spark_stats.gcd = 0;
cap->spark_stats.fizzled = 0;
- cap->io_manager_control_wr_fd = -1;
#endif
cap->total_allocated = 0;
@@ -1078,16 +1077,6 @@ rtsBool checkSparkCountInvariant (void)
}
#endif
-void setIOManagerControlFd(nat cap_no USED_IF_THREADS, int fd USED_IF_THREADS) {
-#if defined(THREADED_RTS)
- if (cap_no < n_capabilities) {
- capabilities[cap_no]->io_manager_control_wr_fd = fd;
- } else {
- errorBelch("warning: setIOManagerControlFd called with illegal capability number.");
- }
-#endif
-}
-
// Local Variables:
// mode: C
// fill-column: 80
diff --git a/rts/Capability.h b/rts/Capability.h
index d5f36c54bc..c7dceefe9f 100644
--- a/rts/Capability.h
+++ b/rts/Capability.h
@@ -126,9 +126,6 @@ struct Capability_ {
// Stats on spark creation/conversion
SparkCounters spark_stats;
-
- // IO manager for this cap
- int io_manager_control_wr_fd;
#endif
// Total words allocated by this cap since rts start
W_ total_allocated;
diff --git a/rts/Linker.c b/rts/Linker.c
index 76cfa8cea0..e97580d61a 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -860,7 +860,6 @@ typedef struct _RtsSymbolVal {
#if !defined(mingw32_HOST_OS)
#define RTS_USER_SIGNALS_SYMBOLS \
SymI_HasProto(setIOManagerControlFd) \
- SymI_HasProto(setTimerManagerControlFd) \
SymI_HasProto(setIOManagerWakeupFd) \
SymI_HasProto(ioManagerWakeup) \
SymI_HasProto(blockUserSignals) \
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index ba4a8b75ea..d5129f0996 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -127,16 +127,12 @@ more_handlers(int sig)
// Here's the pipe into which we will send our signals
static int io_manager_wakeup_fd = -1;
-static int timer_manager_control_wr_fd = -1;
+static int io_manager_control_fd = -1;
#define IO_MANAGER_WAKEUP 0xff
#define IO_MANAGER_DIE 0xfe
#define IO_MANAGER_SYNC 0xfd
-void setTimerManagerControlFd(int fd) {
- timer_manager_control_wr_fd = fd;
-}
-
void
setIOManagerWakeupFd (int fd)
{
@@ -145,9 +141,14 @@ setIOManagerWakeupFd (int fd)
io_manager_wakeup_fd = fd;
}
-/* -----------------------------------------------------------------------------
- * Wake up at least one IO or timer manager HS thread.
- * -------------------------------------------------------------------------- */
+void
+setIOManagerControlFd (int fd)
+{
+ // only called when THREADED_RTS, but unconditionally
+ // compiled here because GHC.Event.Control depends on it.
+ io_manager_control_fd = fd;
+}
+
void
ioManagerWakeup (void)
{
@@ -169,24 +170,14 @@ ioManagerWakeup (void)
void
ioManagerDie (void)
{
- StgWord8 byte = (StgWord8)IO_MANAGER_DIE;
- nat i;
- int fd;
int r;
-
- if (0 <= timer_manager_control_wr_fd) {
- r = write(timer_manager_control_wr_fd, &byte, 1);
+ // Ask the IO Manager thread to exit
+ if (io_manager_control_fd >= 0) {
+ StgWord8 byte = (StgWord8)IO_MANAGER_DIE;
+ r = write(io_manager_control_fd, &byte, 1);
if (r == -1) { sysErrorBelch("ioManagerDie: write"); }
- timer_manager_control_wr_fd = -1;
- }
-
- for (i=0; i < n_capabilities; i++) {
- fd = capabilities[i]->io_manager_control_wr_fd;
- if (0 <= fd) {
- r = write(fd, &byte, 1);
- if (r == -1) { sysErrorBelch("ioManagerDie: write"); }
- capabilities[i]->io_manager_control_wr_fd = -1;
- }
+ io_manager_control_fd = -1;
+ io_manager_wakeup_fd = -1;
}
}
@@ -201,7 +192,7 @@ ioManagerStart (void)
{
// Make sure the IO manager thread is running
Capability *cap;
- if (timer_manager_control_wr_fd < 0 || io_manager_wakeup_fd < 0) {
+ if (io_manager_control_fd < 0 || io_manager_wakeup_fd < 0) {
cap = rts_lock();
ioManagerStartCap(&cap);
rts_unlock(cap);
@@ -232,37 +223,26 @@ generic_handler(int sig USED_IF_THREADS,
{
#if defined(THREADED_RTS)
- StgWord8 buf[sizeof(siginfo_t) + 1];
- int r;
+ if (io_manager_control_fd != -1)
+ {
+ StgWord8 buf[sizeof(siginfo_t) + 1];
+ int r;
- buf[0] = sig;
- 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));
- }
+ buf[0] = sig;
- if (0 <= timer_manager_control_wr_fd)
- {
- r = write(timer_manager_control_wr_fd, buf, sizeof(siginfo_t)+1);
- if (r == -1 && errno == EAGAIN) {
- errorBelch("lost signal due to full pipe: %d\n", sig);
+ 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));
}
- }
- nat i;
- int fd;
- for (i=0; i < n_capabilities; i++) {
- fd = capabilities[i]->io_manager_control_wr_fd;
- if (0 <= fd) {
- r = write(fd, buf, sizeof(siginfo_t)+1);
- if (r == -1 && errno == EAGAIN) {
- errorBelch("lost signal due to full pipe: %d\n", sig);
- }
+ r = write(io_manager_control_fd, buf, sizeof(siginfo_t)+1);
+ if (r == -1 && errno == EAGAIN)
+ {
+ errorBelch("lost signal due to full pipe: %d\n", sig);
}
}
-
// If the IO manager hasn't told us what the FD of the write end
// of its pipe is, there's not much we can do here, so just ignore
// the signal..