Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: ActivePerl Gtk2::Helper Hangs

by bulk88 (Priest)
on Dec 17, 2013 at 07:50 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found