[gambit-list] Embedding swank-gambit

Roger Wilson misterrogerwilson at gmail.com
Mon May 23 15:40:59 EDT 2011


I'm evaluating using Gambit-C Scheme as a scripting type language within my
application.  The main app is written in C++ and I've got the C++ -> Scheme
-> C++ calls all working.  That was all straightforward and I'm pretty happy
with that.  I'm now trying to integrate swank and have hit a bit of a dead
end.  I can run swank-gambit on its own and it just worked, the problem has
come trying to run it  alongside the thread that communicates with the host
C++ app.  I've tried replacing the code at the bottom of swank-gambit.scm
with the following based on the iOS sample.  This creates a new thread that
returns to the C++ host, while the primordial thread creates the swank
server.

(continuation-capture
(lambda (cont)
   (thread-start!
    (make-thread
     (lambda ()
       (continuation-return cont #f))))

   ;; the primordial thread is running this...
   (swank-server-register!)
   (thread-sleep! +inf.0)

   exit)))


That works in as much as it creates the tcp listen port and slime can
connect to it, however it seems that the connection is rarely if ever
serviced.  The calls between C++ and Scheme in the other thread all continue
ok.  Can someone point me in the direction I need to fix this please?  I
suspect I've got a fundamentally wrong understanding of swank or the whole
Gambit threading model.  Do I somehow need to provide execution time to the
primordial thread?

Roger.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110523/1df0cf9f/attachment.htm>


More information about the Gambit-list mailing list