diff options
author | Andreas Voellmy <andreas.voellmy@gmail.com> | 2014-09-16 07:56:54 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-09-16 07:58:36 -0500 |
commit | 7e658bc14e2dd6baf208deebbdab9e1285ce4c72 (patch) | |
tree | 526c6557dd697360c4bc58ff99ecdf6b60c046ed /rts/Capability.c | |
parent | caf449e39f5e7545eeabd567349661450aa8c6e5 (diff) | |
download | haskell-7e658bc14e2dd6baf208deebbdab9e1285ce4c72.tar.gz |
Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.
Summary:
This reverts commit 4748f5936fe72d96edfa17b153dbfd84f2c4c053. The fix for #9423
was reverted because this commit introduced a C function setIOManagerControlFd()
(defined in Schedule.c) defined for all OS types, while the prototype
(in includes/rts/IOManager.h) was only included when mingw32_HOST_OS is
not defined. This broke Windows builds.
This commit reverts the original commit and resolves the problem by only defining
setIOManagerControlFd() when mingw32_HOST_OS is defined. Hence the missing prototype
error should not occur on Windows.
In addition, since the io_manager_control_wr_fd field of the Capability struct is only
usd by the setIOManagerControlFd, this commit includes the io_manager_control_wr_fd
field in the Capability struct only when mingw32_HOST_OS is not defined.
Test Plan: Try to compile successfully on all platforms.
Reviewers: austin
Reviewed By: austin
Subscribers: simonmar, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D174
Diffstat (limited to 'rts/Capability.c')
-rw-r--r-- | rts/Capability.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index 29c5270416..a954006257 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -27,6 +27,10 @@ #include "STM.h" #include "RtsUtils.h" +#if !defined(mingw32_HOST_OS) +#include "rts/IOManager.h" // for setIOManagerControlFd() +#endif + #include <string.h> // one global capability, this is the Capability for non-threaded @@ -255,6 +259,9 @@ initCapability( Capability *cap, nat i ) cap->spark_stats.converted = 0; cap->spark_stats.gcd = 0; cap->spark_stats.fizzled = 0; +#if !defined(mingw32_HOST_OS) + cap->io_manager_control_wr_fd = -1; +#endif #endif cap->total_allocated = 0; @@ -1076,6 +1083,18 @@ rtsBool checkSparkCountInvariant (void) } #endif +#if !defined(mingw32_HOST_OS) +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 +} +#endif + // Local Variables: // mode: C // fill-column: 80 |