[gambit-list] Gambit and event-based systems

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Thu Aug 7 08:13:20 EDT 2014

On Thu, Aug 7, 2014 at 1:56 PM, Alex Queiroz <asandroq at gmail.com> wrote:

> Hallo,
> On Thu, Aug 7, 2014 at 1:46 PM, Álvaro Castro-Castilla
> <alvaro.castro.castilla at gmail.com> wrote:
> >
> > Hi,
> >
> > Specially in the mobile world, there are many platforms that force the
> developer to think and code its applications around events. Sometimes this
> is done with virtual functions or interface implementation, overriding
> methods, or plain C-style callbacks.
> >
> > The problem is, in any of these cases, generally the main loop is
> controlled by the application. Since Gambit runs within the
> ___setup(params) function, and then quits (expecting ___cleanup() to be
> called), there is no way to easily adapt to this architecture except for
> running in a separate thread and communicating through messages or shared
> data.
> >
> > Is there a better way to do this?
> >
> Why can't you package your program as a C library that has an API for
> the events?
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.

If there is just one thread, how can you run Gambit, then leave the
___setup function and let the system call whatever event it requires?
For instance, in SDL2, you are required to define a draw/update callback in
iOS and then leave the main. If you don't return from Gambit's ___setup()
in main, the draw/update callback is never run.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20140807/86b51dfd/attachment.htm>

More information about the Gambit-list mailing list