<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi all,</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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</p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal style='line-height:13.5pt;background:#1C1C1C'><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> </span><span style='font-size:10.0pt;font-family:Consolas;color:#F92672'>if</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> (cap</span><span style='font-size:10.0pt;font-family:Consolas;color:#F92672'>-></span><span style='font-size:10.0pt;font-family:Consolas;color:#FD971F'>in_haskell</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'>) {<o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:13.5pt;background:#1C1C1C'><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> </span><span style='font-size:10.0pt;font-family:Consolas;color:#B0EC38'>errorBelch</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'>(</span><span style='font-size:10.0pt;font-family:Consolas;color:#E6DB74'>"schedule: re-entered unsafely.</span><span style='font-size:10.0pt;font-family:Consolas;color:#E62A19'>\n</span><span style='font-size:10.0pt;font-family:Consolas;color:#E6DB74'>"</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:13.5pt;background:#1C1C1C'><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> </span><span style='font-size:10.0pt;font-family:Consolas;color:#E6DB74'>" Perhaps a 'foreign import unsafe' should be 'safe'?"</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'>);<o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:13.5pt;background:#1C1C1C'><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> </span><span style='font-size:10.0pt;font-family:Consolas;color:#B0EC38'>stg_exit</span><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'>(EXIT_FAILURE);<o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:13.5pt;background:#1C1C1C'><span style='font-size:10.0pt;font-family:Consolas;color:#CCCCCC'> }<o:p></o:p></span></p></div></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Clause in the scheduler.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.</p><p class=MsoNormal>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.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In short, does anyone know of a way to initialize an I/O operation from the non-threaded RTS?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks,</p><p class=MsoNormal>Tamar</p><p class=MsoNormal><o:p> </o:p></p></div></body></html>