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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Multithreading and Shared Objects

 



DrTom
New User

Jan 17, 2011, 1:50 PM

Post #1 of 1 (250 views)
Multithreading and Shared Objects Can't Post

I'm trying to share an object in a multithreaded script. I can't use:

my $x : new;

So, I tried using a pointer to the variable as an argument to the spawning of the thread:

my $Test = new TestObj (1);
my $TestPtr = \$Test;
my $tid1 = new threads(\&Child1, $TestPtr);

When I print out the value of the pointer inside the thread, it is not the same value as in the main thread. What am I doing wrong?

 
 


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

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