[gambit-list] Gambit and event-based systems
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:
>> 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
> 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...
More information about the Gambit-list