[gambit-list] Gambit and event-based systems

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Thu Aug 7 09:06:26 EDT 2014

On Thu, Aug 7, 2014 at 2:31 PM, Álvaro Castro-Castilla <
alvaro.castro.castilla at gmail.com> wrote:

> On Thu, Aug 7, 2014 at 2:19 PM, Alex Queiroz <asandroq at gmail.com> wrote:
>> Hallo,
>> On Thu, Aug 7, 2014 at 2:13 PM, Álvaro Castro-Castilla
>> <alvaro.castro.castilla at gmail.com> wrote:
>> >
>> > That works for implementing the events, but where is the Gambit ___setup
>> > function running? You can't return from this function without breaking
>> > Gambit's system.
>> >
>> `___setup` doesn't need to be "running". You call it and after it is
>> finished, you can call your functions. If your code needs to do work
>> in the background, you can install a timer in the host system and keep
>> calling into Gambit.
> Yes, you are right. I've actually done it long time ago, now that I
> recall. Let me try the idea, and see if I can cleanly satisfy the library
> requirement.
> But yes, apparently I wasn't thinking, since if you don't have to keep
> running ___setup() then it's easy to implement callbacks. Actually, the
> name ___setup and the fact that ___cleanup is an independent function makes
> it pretty clear. Otherwise it would have been ___run or something similar.
> The confusion stemmed from the fact that I was running Scheme code directly
> without calling any (c-define)'d function after ___setup(). But as I said,
> I've done that before, so I wasn't thinking.
> Thank you!

Okay, it wasn't that easy. I *do* need to have a Gambit thread running a
loop in the background as well. How can I keep that loop running?
When you said "install a timer in the host system and keep calling" you
mean that I need to break up that loop into a callback which is called with
a repeating timer? (I think this is not a good solution).
 And then, where would you create and start that thread?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20140807/b3c5ef47/attachment.htm>

More information about the Gambit-list mailing list