[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Question on Multithreading from C API



I suspect that it would be easiest to do most of this programming in 
Scheme, rather than most of it in C. If you just have the C code call 
a particular procedure with the strings it gets over the wire, you 
can define the function that gets called in Scheme. That is, when the 
C code is installed, lookup the binding for some global variable in 
the current namespace. Then, each time a string comes in, just call 
that function with the string.

The function called would look something like this:

(define (start-computation str)
   (let ([exp (read-from-string str)])
     (eval
       `(thread
          (lambda ()
            (with-handlers ([(lamdba (x) #t) (lambda (x) (cons #f x))])
              (cons #t ,exp))))))

Of course, you would need more, since this doesn't communicate it's 
result with anyone.

[ The procedure you were looking for (probably) is called `current-thread'. ]

Robby