<table cellspacing='0' cellpadding='0' border='0' ><tr><td valign='top' style='font: inherit;'>Something I would love to see is a mechanism like the one in the
Visualworks Smalltalk FFI. In VW you can add a _threaded flag to the
definition of your external procedure, and the rest will work
automatically. You then wrap this in a green thread and you're done. To
make garbage collection possible, memory used in such calls are moved
to a special place where the memory location is guaranteed to not
change during the threaded call. For performance, the FFI machinery
starts up a couple of worker threads and hands the threaded procedure
calls over to the first free worker thread. I've heard that there are some possible pitfalls, but for the simple case it works amazingly well.<br><br>Danny<br><br>--- YC <i>&lt;yinso.chen@gmail.com&gt;</i> schrieb am <b>Do, 19.6.2008:<br></b><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><b>Von: YC &lt;yinso.chen@gmail.com&gt;<br>Betreff: Re: [plt-scheme] Newbie question: non-blocking IO<br>An: "pltscheme" &lt;plt-scheme@list.cs.brown.edu&gt;<br>CC: chan_dhf@yahoo.de<br>Datum: Donnerstag, 19. Juni 2008, 0:06<br><br></b><div id="yiv628207572"><b>There is a proposal for ffi+thread in&nbsp; <a rel="nofollow" target="_blank" href="http://www.cs.brown.edu/pipermail/plt-scheme/2007-July/019592.html">http://www.cs.brown.edu/pipermail/plt-scheme/2007-July/019592.html</a> - does anyone knows what happened there? <br>
<br>I imagine that the default file ports do not block if they are running in separate scheme threads - is it correct?&nbsp; Perhaps that can be leveraged (i.e. pipe the FFI result to a port and then read from it)?&nbsp; (I don't really know about the details here - just making guesses...)<br>
<br><br></b><div class="gmail_quote"><b>On Wed, Jun 18, 2008 at 6:51 AM, Chongkai Zhu &lt;<a rel="nofollow" target="_blank" href="mailto:czhu@cs.utah.edu">czhu@cs.utah.edu</a>&gt; wrote:<br></b><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<b>The only solution I can see is to implement you own thread in C, and make sure only your main thread talks to Scheme.<br>
<br>
Chongkai</b><div><div></div><div class="Wj3C7c"><b><br>
<br>
<br>
Danny Chan wrote:<br>
</b><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<b>Hi!<br>
I'd like to write a program that captures a video flow from a camera developed in my company. I already found out how to talk to the low level C libraries that are needed to talk to our hardware using the FFI. However, the functions to grab images from the camera are blocking until a data buffer has been filled. But to get the necessary frame rate, I need to process the last captured frame while waiting for the next frame. If I read the documentation correctly, PLT Scheme uses green threads, so that the call to my C function will block the scheme process even if it is done in a dedicated scheme thread. If this is correct, is there a simple way to achieve a non-blocking call to a C function?<br>

<br>
Thanks, Danny<br>
<br>
<br>
</b></blockquote></div></div>
<b>_________________________________________________<br>
&nbsp;For list-related administrative tasks:<br>
&nbsp;<a rel="nofollow" target="_blank" href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</b></blockquote></div><b><br>
</b></div></blockquote></td></tr></table><br>



      <hr size=1>
Gesendet von <a  
href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52427/*http://de.overview.mail.yahoo.com" target=_blank>Yahoo! Mail</a>.
<br>
Dem pfiffigeren Posteingang.