Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^4: ActivePerl Gtk2::Helper Hangs

by bulk88 (Priest)
on Dec 17, 2013 at 07:50 UTC ( #1067428=note: print w/replies, xml ) Need Help??

in reply to Re^3: ActivePerl Gtk2::Helper Hangs
in thread ActivePerl Gtk2::Helper Hangs

I would try to remove the "while (Gtk2->events_pending()) {Gtk2->main_iteration();}", it is a waste of memory/stack recursion and CPU. repeat_call is called from a 10 ms timer, from the event loop. When repeat_call returns, more events will run automatically. "while (Gtk2->events_pending()) {Gtk2->main_iteration();}" is to make the app responsive when doing CPU intensive data processing in a single thread. It isn't for generic eventloops running (which is Gtk2->main();). By putting "while (Gtk2->events_pending()) {Gtk2->main_iteration();}" in an event handler, you basically wrote
sub foo { #process the event if(rand() > 0.5) { foo(); } } foo();
0.5 might be anywhere from 0.001 to 0.9. IDK what it will be in your app. Never do something with recursion when it can be processed with a loop. You will blow the stack of whatever language you are using. Perl might, but no guarantee of it doing this, give you a "Deep recursion on subroutine "%s"" warning, see Deep recursion on subroutine "%s".

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1067428]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-07-04 06:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found