[plt-scheme] Newbie question: non-blocking IO

From: Danny Chan (chan_dhf at yahoo.de)
Date: Thu Jun 19 02:53:15 EDT 2008

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.

Danny

--- YC <yinso.chen at gmail.com> schrieb am Do, 19.6.2008:
Von: YC <yinso.chen at gmail.com>
Betreff: Re: [plt-scheme] Newbie question: non-blocking IO
An: "pltscheme" <plt-scheme at list.cs.brown.edu>
CC: chan_dhf at yahoo.de
Datum: Donnerstag, 19. Juni 2008, 0:06

There is a proposal for ffi+thread in  http://www.cs.brown.edu/pipermail/plt-scheme/2007-July/019592.html - does anyone knows what happened there? 


I imagine that the default file ports do not block if they are running in separate scheme threads - is it correct?  Perhaps that can be leveraged (i.e. pipe the FFI result to a port and then read from it)?  (I don't really know about the details here - just making guesses...)



On Wed, Jun 18, 2008 at 6:51 AM, Chongkai Zhu <czhu at cs.utah.edu> wrote:

The only solution I can see is to implement you own thread in C, and make sure only your main thread talks to Scheme.



Chongkai





Danny Chan wrote:


Hi!

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?




Thanks, Danny






_________________________________________________

 For list-related administrative tasks:

 http://list.cs.brown.edu/mailman/listinfo/plt-scheme






      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080619/fa29f12d/attachment.html>

Posted on the users mailing list.