Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Need help in using threads in Tk

by zentara (Archbishop)
on Apr 28, 2012 at 11:29 UTC ( [id://967799]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Need help in using threads in Tk
in thread Need help in using threads in Tk

Your big problem as far as threads and Tk goes, is that you are trying to start threads after Tk code has been written. Tk is not threadsafe. It looks like you should be able to reorganize your code fairly easily. See PerlTk on a thread... for a simple Th with threads example, and some rules to follow. Also, if you are on a single cpu machine, using threads probably will not increase your performance.

So, create your thread first, before tkinit, then confine all your network code to the thread.

By the way, not to confuse you further, but Perl/Gtk2 will allow you to create threads after the GUI code is init'ed, but it still is a good rule to keep thread code and GUI code separate.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found