[gambit-list] Pushing events between C++ and Scheme + timers

Joel Reymont joelr at well.com
Wed Dec 8 14:30:20 EST 2004


> Marc Feeley wrote:
>Are you willing to start a C thread for the Scheme code? 

I could but I'd rather avoid it if I can.

>This would
>decouple control between Scheme and C, allowing timers to be
>implemented in Scheme with the I/O timeout mechanisms.  

How would you implement these timers?

>Then you need
>two pipes between the C and Scheme worlds.  These pipes could be
>actual OS pipes, sockets, or a new type of device (this would be more
>efficient and portable, but require the implementation of a new device
>in _os_io.c).

Can they be simple Scheme lists?

I thought I could have 3 Scheme functions I would call from C++ where one
would start the Scheme loop in a Scheme thread and the other two would
let C++ post events (sexp) to the "incoming events" Scheme list and the
other would retrieve them from the "outgoing" list. The post/retrieve
functions would use a mutex to block access to the lists/queues. Then I
could do the timer by launching another thread within Gambit.

Maybe I'm misunderstanding the nature of integration that would be
required here. Please let me know!

    Thanks, Joel

-- 
OpenPoker: The Linux of poker software
http://wagerlabs.com/forums




More information about the Gambit-list mailing list