Re: [AD] END_OF_MAIN removal patch for msvc

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


On November 18, 2008, Peter Wang wrote:
> 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,

If the user does his job, theres one polling call ;)

> no reworking your program to work as a non-blocking callback.

Rework what? This is a new lib with a new api. We can do whatever we want.

But this isn't a bad idea either. something like the following?

int main(int argc, char **argv)
{
	// setup stuff
	....
	return al_run(my_main, argc, argv);
} 

this way we get the params, and can get rid of END_OF_MAIN, and any associated 
hacks.

So long as running the user's code in a separate thread causes less (and less 
serious) problems than the current and other proposed setups I'm all for it.

> Peter
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge Build the coolest Linux based applications with Moblin SDK & win
> great prizes Grand prize is a trip for two to an Open Source event anywhere
> in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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