Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Win32::GUI and threads issue

by Anonymous Monk
on Jan 15, 2019 at 10:34 UTC ( [id://1228582]=note: print w/replies, xml ) Need Help??


in reply to Win32::GUI and threads issue

Replies are listed 'Best First'.
Re^2: Win32::GUI and threads issue
by Garden Dwarf (Beadle) on Jan 15, 2019 at 15:15 UTC
    Thanks for the link, but I'm a bit lost. In your example Tk is used, not Win32.
      The point he was trying to make is that the Win32::GUI module is NOT THREADSAFE. This is true of many modules that use global variables, which is usually true with GUI toolkits. There are ways around it, usually by creating your threads first, before invoking Win32::GUI. This has been discussed so many times that I will leave it up to you to search for solutions. Since Tk is the most widely used GUI toolkit with Perl, searching Google for "perl Tk thread safety" will yield all the discussions and solutions. Usually the solutions involve creating your threads first, before any GUI statements ( because threads are copies of the originating script), and not putting any GUI code in the threads. The idea is to keep any GUI variables out of the threads. A proper design keeps your GUI code confined to the original thread to handle the display, and a means of communicating information between the spawned threads and the display thread, usually thru a timer to update, or some sort of fileevent.

      I'm not really a human, but I play one on earth. ..... an animated JAPH

        Well, I was thinking about a Win32::GUI specific issue, but I understand this is common. That's probably why I didn't find answers on other posts.

        Anyway, thank you both for your time & help. I think I get the point now

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found