Re: [AD] END_OF_MAIN removal patch for msvc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-11-19, Stefanos A. <stapostol@xxxxxxxxxx> wrote:
> On Tue, 2008-11-18 at 16:07 -0700, Thomas Fjellstrom wrote:
> > On November 18, 2008, Paul Suntsov wrote:
> > > If I may butt in, but reducing choice and forcing people into a single (and
> > > flawed when it comes to games, in my opinion) paradigm only to remove a
> > > single macro is not the right solution.
> > 
> > Yeah, I'm not sure going whole hog on the event system is the right direction, 
> > but neither are hacks like END_OF_MAIN.
> 
> The idea is that it is easy to build a polling paradigm on top of an
> event system, but it is hard to go the other way round (this is
> mentioned in the A4 manual, actually).
> 
> If I understand correctly, the main block for END_OF_MAIN is MacOS,
> where the event loop must be in the main thread. In this case, why not
> have Allegro simply control the main thread? 
> 
> int main(void)
> {
>     al_init();
>     [...]
>     al_run([callback]);
> 
>     return 0;
> }
> 
> Since all A5 platforms run on event loops internally, this is trivial to
> implement (the user's code is called whenever the Allegro event loop
> hits idle).

That's hardly trivial.

Why not my suggestion, which is for the user to give over the main
thread to Allegro, which must happen one way or another on Mac OS X.  In
return, Allegro starts a function of the user's choosing in a new
thread.  That's it.  No tricks, no name mangling, no hidden symbols, no
polling calls everywhere, no reworking your program to work as a
non-blocking callback.  

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/