Reactor.throwInFiber

forward an exception to another fiber

This function throws an exception in another fiber. The fiber will be scheduled to run.

There is a difference in semantics between the two forms. The first form throws an identical copy of the exception in the target fiber. The second form forms a new exception to be thrown in that fiber.

One place where this difference matters is with the stack trace the thrown exception will have. With the first form, the stack trace will be the stack trace ex has, wherever it is (usually not in the fiber in which the exception was thrown). With the second form, the stack trace will be of the target fiber, which means it will point back to where the fiber went to sleep.

  1. bool throwInFiber(FiberHandle fHandle, Throwable ex)
    struct Reactor
    nothrow @safe @nogc
    bool
    throwInFiber
    (,
    Throwable ex
    )
  2. bool throwInFiber(FiberHandle fHandle, A args)

Meta