CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Shared hash across multiple threads


New User

Feb 2, 2011, 5:42 AM

Post #1 of 1 (2812 views)
Shared hash across multiple threads Can't Post

Writing a Perl Tcl/Tk GUI application. Need to share a hash across multiple perl threads. In particular, this hash is the TixGrid. When I print out the address of the instance of the TixGrid outside of the thread, I get one value, and I print out the address of the instance of the TixGrid inside the thread I get another address. Then when I try to set a value of the TixGrid within the thread the program crashes. The TixGrid instance is stored in a parent hash, like $mydata->{mytixgrid},
and I do declare the mydata shared via:

my %mydata : shared;

I also did try to declare $mydata->{} shared via:


but the perl interpreter did not recognize the share function, eventhough I have:

use Threads;
use Threads::Shared;

Any help would be appreciated. Also, I can explain more about the structure and purpose of this program and my motivation for needing to share a TixGrid across multiple threads if interested.





Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives