Jump to content


Check out our Community Blogs

DrTom

Member Since 18 Jan 2011
Offline Last Active Sep 13 2011 03:10 PM
-----

Posts I've Made

In Topic: Multithreading Shared Objects

01 February 2011 - 11:10 AM

That's my point - you can't use "shared" and "new". However, I don't understand why passing a variable by reference to a subroutine does not have the same effect in a multithreaded scenario vs. a single threaded scenario.

In Topic: Multithreading Shared Objects

01 February 2011 - 05:28 AM

That does not make sense. If you comment out the line that says:

printf ("\nSingle thread...\n");

Then you simply repeat the same print statement twice.

The reason I pass a reference to both calls of Child1 is to allow Child1 to modify the content of $TestObj. When I check the value of $TestObj in the main thread after the multithread call, it reverts back to the value it had prior to the call. However, when I do the single thread call, the change is reflected. Child1 simply sets the value of $TestObj->{a} to 2. Both print statements in the main thread should have the value of 2 after both calls.

In Topic: Multithreading Shared Objects

31 January 2011 - 02:04 PM

BUt I want Child1 to modify it. When done as a single thread, it accomplishes that objective. When done multihreaded, it does not.

In Topic: Multithreading Shared Objects

31 January 2011 - 12:32 PM

I put the printf after the call to Child1 to see the effect of calling Child1. Putting the printf before it doesn't accomplish that, or am I missing something?

In Topic: Multithreading Shared Objects

31 January 2011 - 12:04 PM

Sorry about that. I uploaded the wrong file. I now have the correct file there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download