[racket] Racket embedding

From: Thomas Chust (chust at web.de)
Date: Thu Dec 12 12:23:15 EST 2013

On 2013-12-12 17:53, Jan Wedekind wrote:
> [...]
> However when doing embedding there is no single 'run' method to
> pass to 'scheme_main_setup'. Is there another simple way to do that?
> [...]

Hello,

it is probably a bad idea to use any setup that doesn't have a single
"run" method! If you reenter the interpreter with a different stack
setup, things like continuations from a previous run could easily break.

Since each Racket interpreter is also single-threaded, it's probably
best to employ a dedicated evaluation thread that does have a single run
method and services requests coming in through some queuing mechanism.

This will also allow you to keep Racket background threads running in
the background rather than blocking all Racket threads between calls
into your Racket binding.

Simply spawning Racket in a subprocess rather than embedding the
interpreter may also be an option, although the marshalling overhead for
in-process inter-thread communication may be somewhat lower than for
inter-process communication.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


Posted on the users mailing list.