Commit d8642002 authored by Ben Gamari's avatar Ben Gamari 🐢

Revert "Install toplevel handler inside fork."

The test associated with this has given us too much trouble. It's not
worth the pain for a minor release.

This reverts commit fb0f4cf6.
parent 6c6f9c1d
...@@ -245,10 +245,6 @@ void rts_evalIO (/* inout */ Capability **, ...@@ -245,10 +245,6 @@ void rts_evalIO (/* inout */ Capability **,
/* in */ HaskellObj p, /* in */ HaskellObj p,
/* out */ HaskellObj *ret); /* out */ HaskellObj *ret);
void rts_evalStableIOMain (/* inout */ Capability **,
/* in */ HsStablePtr s,
/* out */ HsStablePtr *ret);
void rts_evalStableIO (/* inout */ Capability **, void rts_evalStableIO (/* inout */ Capability **,
/* in */ HsStablePtr s, /* in */ HsStablePtr s,
/* out */ HsStablePtr *ret); /* out */ HsStablePtr *ret);
......
...@@ -51,7 +51,6 @@ PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure); ...@@ -51,7 +51,6 @@ PRELUDE_CLOSURE(base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure);
PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlersPtr_closure); PRELUDE_CLOSURE(base_GHCziConcziSignal_runHandlersPtr_closure);
PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure); PRELUDE_CLOSURE(base_GHCziTopHandler_flushStdHandles_closure);
PRELUDE_CLOSURE(base_GHCziTopHandler_runMainIO_closure);
PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_static_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Czh_static_info);
PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_static_info); PRELUDE_INFO(ghczmprim_GHCziTypes_Izh_static_info);
...@@ -100,7 +99,6 @@ PRELUDE_INFO(base_GHCziStable_StablePtr_con_info); ...@@ -100,7 +99,6 @@ PRELUDE_INFO(base_GHCziStable_StablePtr_con_info);
#define runHandlersPtr_closure DLL_IMPORT_DATA_REF(base_GHCziConcziSignal_runHandlersPtr_closure) #define runHandlersPtr_closure DLL_IMPORT_DATA_REF(base_GHCziConcziSignal_runHandlersPtr_closure)
#define flushStdHandles_closure DLL_IMPORT_DATA_REF(base_GHCziTopHandler_flushStdHandles_closure) #define flushStdHandles_closure DLL_IMPORT_DATA_REF(base_GHCziTopHandler_flushStdHandles_closure)
#define runMainIO_closure DLL_IMPORT_DATA_REF(base_GHCziTopHandler_runMainIO_closure)
#define stackOverflow_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_stackOverflow_closure) #define stackOverflow_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_stackOverflow_closure)
#define heapOverflow_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_heapOverflow_closure) #define heapOverflow_closure DLL_IMPORT_DATA_REF(base_GHCziIOziException_heapOverflow_closure)
......
...@@ -459,35 +459,6 @@ void rts_evalIO (/* inout */ Capability **cap, ...@@ -459,35 +459,6 @@ void rts_evalIO (/* inout */ Capability **cap,
scheduleWaitThread(tso,ret,cap); scheduleWaitThread(tso,ret,cap);
} }
/*
* rts_evalStableIOMain() is suitable for calling main Haskell thread
* stored in (StablePtr (IO a)) it calls rts_evalStableIO but wraps
* function in GHC.TopHandler.runMainIO that installs top_handlers.
* See Trac #12903.
*/
void rts_evalStableIOMain(/* inout */ Capability **cap,
/* in */ HsStablePtr s,
/* out */ HsStablePtr *ret)
{
StgTSO* tso;
StgClosure *p, *r, *w;
SchedulerStatus stat;
p = (StgClosure *)deRefStablePtr(s);
w = rts_apply(*cap, &base_GHCziTopHandler_runMainIO_closure, p);
tso = createStrictIOThread(*cap, RtsFlags.GcFlags.initialStkSize, w);
// async exceptions are always blocked by default in the created
// thread. See #1048.
tso->flags |= TSO_BLOCKEX | TSO_INTERRUPTIBLE;
scheduleWaitThread(tso,&r,cap);
stat = rts_getSchedStatus(*cap);
if (stat == Success && ret != NULL) {
ASSERT(r != NULL);
*ret = getStablePtr((StgPtr)r);
}
}
/* /*
* rts_evalStableIO() is suitable for calling from Haskell. It * rts_evalStableIO() is suitable for calling from Haskell. It
* evaluates a value of the form (StablePtr (IO a)), forcing the * evaluates a value of the form (StablePtr (IO a)), forcing the
......
...@@ -647,7 +647,6 @@ ...@@ -647,7 +647,6 @@
SymI_HasProto(rts_eval) \ SymI_HasProto(rts_eval) \
SymI_HasProto(rts_evalIO) \ SymI_HasProto(rts_evalIO) \
SymI_HasProto(rts_evalLazyIO) \ SymI_HasProto(rts_evalLazyIO) \
SymI_HasProto(rts_evalStableIOMain) \
SymI_HasProto(rts_evalStableIO) \ SymI_HasProto(rts_evalStableIO) \
SymI_HasProto(rts_eval_) \ SymI_HasProto(rts_eval_) \
SymI_HasProto(rts_getBool) \ SymI_HasProto(rts_getBool) \
......
...@@ -2078,10 +2078,7 @@ forkProcess(HsStablePtr *entry ...@@ -2078,10 +2078,7 @@ forkProcess(HsStablePtr *entry
ioManagerStartCap(&cap); ioManagerStartCap(&cap);
#endif #endif
// Install toplevel exception handlers, so interruption rts_evalStableIO(&cap, entry, NULL); // run the action
// signal will be sent to the main thread.
// See Trac #12903
rts_evalStableIOMain(&cap, entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",cap); rts_checkSchedStatus("forkProcess",cap);
rts_unlock(cap); rts_unlock(cap);
......
...@@ -106,7 +106,6 @@ ld-options: ...@@ -106,7 +106,6 @@ ld-options:
, "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure" , "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
, "-Wl,-u,_base_GHCziTopHandler_runIO_closure" , "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
, "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure" , "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
, "-Wl,-u,_base_GHCziTopHandler_runMainIO_closure"
, "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure" , "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
, "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure" , "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
, "-Wl,-u,_base_GHCziConcziSync_runSparks_closure" , "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
...@@ -149,7 +148,6 @@ ld-options: ...@@ -149,7 +148,6 @@ ld-options:
, "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure" , "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
, "-Wl,-u,base_GHCziTopHandler_runIO_closure" , "-Wl,-u,base_GHCziTopHandler_runIO_closure"
, "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" , "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
, "-Wl,-u,base_GHCziTopHandler_runMainIO_closure"
, "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure" , "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
, "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure" , "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
, "-Wl,-u,base_GHCziConcziSync_runSparks_closure" , "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
......
import Control.Concurrent
import Control.Exception
import System.Posix
main = do
pid <- forkProcess $ do
handle (\UserInterrupt{} -> putStrLn "caught")
$ threadDelay 2000000
signalProcess sigINT pid
threadDelay 2000000
...@@ -345,5 +345,3 @@ test('T10296b', [only_ways('threaded2')], compile_and_run, ['']) ...@@ -345,5 +345,3 @@ test('T10296b', [only_ways('threaded2')], compile_and_run, [''])
test('T12497', [ unless(opsys('mingw32'), skip) test('T12497', [ unless(opsys('mingw32'), skip)
], ],
run_command, ['$MAKE -s --no-print-directory T12497']) run_command, ['$MAKE -s --no-print-directory T12497'])
test('T12903', [ when(opsys('mingw32'), skip)], compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment