Re: [AD] MSG_IDLE in grabber and menus

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


Elias Pschernig wrote:

> 1 - deprecate do_dialog and leave everything to the user, current code
> using do_dialog is out of luck (my patch for grabber went that way..)

Don't do that unless it can be avoided; changing old code is a lot to
ask for something relatively simple as this. I don't think that's the
way to go.

> 2 - scan for d_yield_proc (as Eric suggested)

Fine with me behaviour-wise, but it seems rather illogical. it would
have to be documented well that adding a d_idle_proc also changes menu
behaviour. If this is only done for do_dialog I see no problem, but if
it also affects behaviour of update_dialog/update_menu it may cause
problems.
 
> 4 - call yield_timeslice in do_dialog while a menu is being displayed
> (and not in update_dialog)

That seems like an innocent solution to me, _if_ the menus are indeed
blocking. 

> 4b - have a global gui_idle_behavior flag, just like gui_mouse_focus,
> which controls if 4 is done or not. Default would be on.

This would work, but is perhaps not necessary. fixing do_dialog should
be enough in my opinion, users can solve it themselves when using
update_dialog/menu. more change than needed is probably not good.

> 5 - have a global idle callback

See above for point 4b.

> Personally, I think either way is good (or solution 1) - since I want to
> have < 100% CPU usage in Allegro GUI programs, which can't be done with
> yield-timeslice, and therefore requires current code to be modified
> anyway. 

Agreed, for do_dialog. _not_ for update_dialog, probably.

> (Btw. Angelo told me yesterday in #allegro the reason for the
> behavior of yield_timeslice in BeOS/QNX/OSX was that users complained
> about the 100% CPU usage of Allegro :)

In that case, I think the behaviour should be corrected. Either in
windows/linux/unix/(dos), or in BeOS/QNX/OSX. Part of the problem is
that the behaviour isn't the same: we can't indiscriminately call
yield_timeslice in non-blocking functions because it actually sleeps
on some OS's. If it never slept but always just "yielded", calling it
in the menu/dialog as a standard probably wouldn't hurt at all.

I suggest changing the yield_timeslice everywhere to the linux/windows
behaviour, and then creating al_sleep like you suggested for when you
really want CPU usage to go down to 0. The grabber and other allegro
programs can the be modified as required (either using
update_dialog / al_sleep or with a standard yield or sleep in
do_dialog) so they behave nicely and don't eat up CPU.

Hein Zelle

>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-< 
 Unix is user friendly. It's just very particular about who 
 it's friends are.

 Hein Zelle                     hein@xxxxxxxxxx
	                        http://www.icce.rug.nl/~hein
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<




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