Running IO function from RTS

lonetiger at gmail.com lonetiger at gmail.com
Mon Nov 26 21:19:56 UTC 2018


Hi all,

I’m looking for a way to initiate a call from the RTS into Haskell (base function) running and evaluating an IO function using the non-threaded RTS.

For the threaded RTS I can use rts_evalIO with the RTS capability, but for the non-threaded I can’t find a way that doesn’t trigger the

    if (cap->in_haskell) {
          errorBelch("schedule: re-entered unsafely.\n"
                     "   Perhaps a 'foreign import unsafe' should be 'safe'?");
          stg_exit(EXIT_FAILURE);
    }

Clause in the scheduler.

Taking a look at how the non-threaded I/O manager currently works on Windows, it seems that re-uses the TSO from the blocked thread doing the I/O call to give notifications back.
This approach doesn’t work for me since the new I/O manager doesn’t block doing a foreign call boundary, instead It blocks in Haskell on an MVar, and I only want to wake up very specific threads.

In short, does anyone know of a way to initialize an I/O operation from the non-threaded RTS?

Thanks,
Tamar

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181126/f94e6506/attachment.html>


More information about the ghc-devs mailing list