[plt-scheme] threads and mzscheme

From: Hans Oesterholt-Dijkema (hdnews at gawab.com)
Date: Mon May 23 16:28:02 EDT 2005

Matthew Flatt schreef:

>At Mon, 23 May 2005 22:02:16 +0200, Hans Oesterholt-Dijkema wrote:
>> From the "Inside" manual: on scheme_block_until()
>>"If |f| ever returns a true value, it must continue to return a true 
>>value. "
>>Until when? Until scheme_block_until() returns?
>Yes. (I've adjusted the manual.)
Thank you. I'm going to implement following:

1. I'll create a C shared variable V=0.
2. I'll start another C-thread, calling PQExec.
3. I'll call scheme_block_until(), with f() returning V.
4. When PQExec returns, the C-thread will set V=1
5. I'll join the C thread.

This will probably do the job, although some overhead
will be involved when running PQExec through a thread.
Another solution might be:

Given a C-semaphore: S1=0
1. I'll create a C shared variable V, and Q(eury).
2. I'll create a C-thread that waits on semaphore S1.
3. I'll set Q to the query requested and V=0.
4. I'll post S1, which starts the C-thread, which calls PQExec.
5. Ill call scheme_block_until, with f() returning V.
6. When PQExec returns the C-thread will put the result in R, and then 
set V to 1, next it will wait on S1.
7. R is returned.

Which one would you choose? (note: both solutions will instantiate threads
per sqli-connect (see google: sqli/sqld).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20050523/a0abcbfa/attachment.html>

Posted on the users mailing list.