On Sunday 11 September 2005 01:08, zentara wrote: > First, you were not properly sharing the return values from the > threads. I have found that when you share hashes, only the first level > keys get shared, so you need to explicitly declare deeper shared hash > elements. OK. I'm not too concerned whether the data passed into the threaded function is shared, it's a small amount of data. The biggie is the data that was getting generated/returned by the sub. It was typically a megabyte or two, and that was happening a few hundred times, which caused things to add up.
> Second, you were not passing a "thread number" to the hash, so how > could you know which thread contained which results? Well, I was passing a reference to the hash that the results were to be placed into to the threaded function. My goal was to simply have it place the results into that hash ref that it was given. > Third, you actually pass the input-values to the thread when you create > them. You could just use shared vars to let the threads get the values. > That way, you would only need to pass the thread number to start the > thread. Your @data:shared really does nothing in your script, because > you are passing the data in at thread creation. But passing them in is > alright, you just need to insure there is a shared var to hold the > return values, so the main thread can read them. OK. > Here is a working example, trying to keep as much of your code as > possible, but you could do without your @data:shared since you pass > the data in. Cheers. It's not quite as elegant as I hoped was possible, but it works which is a major step forward. I'll look into the changes you made, they should help me understand what's going on. thanks, -- Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]> Hostes alienigeni me abduxerunt. Qui annus est? PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
pgpeGA1srITjc.pgp
Description: PGP signature