Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit eef5dc5

Browse files
committed
Make rt_trapExceptions apply to fibers as well
1 parent a833234 commit eef5dc5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/core/thread.d

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3514,6 +3514,8 @@ shared static this()
35143514

35153515
private
35163516
{
3517+
extern extern (C) __gshared bool rt_trapExceptions;
3518+
35173519
extern (C) void fiber_entryPoint()
35183520
{
35193521
Fiber obj = Fiber.getThis();
@@ -3524,13 +3526,21 @@ private
35243526
obj.m_ctxt.tstack = obj.m_ctxt.bstack;
35253527
obj.m_state = Fiber.State.EXEC;
35263528

3527-
try
3529+
3530+
if (rt_trapExceptions)
35283531
{
3529-
obj.run();
3532+
try
3533+
{
3534+
obj.run();
3535+
}
3536+
catch( Throwable t )
3537+
{
3538+
obj.m_unhandled = t;
3539+
}
35303540
}
3531-
catch( Throwable t )
3541+
else
35323542
{
3533-
obj.m_unhandled = t;
3543+
obj.run();
35343544
}
35353545

35363546
static if( __traits( compiles, ucontext_t ) )

0 commit comments

Comments
 (0)