Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: sharing complex data structures

by renodino (Curate)
on Jul 08, 2008 at 03:13 UTC ( #696146=note: print w/ replies, xml ) Need Help??


in reply to sharing complex data structures

  1. What version of Perl are you using ?
  2. What version of threads are you using ?
  3. What version of threads::shared are you using ?
And yes, you need to share the $res object. Every reference stored in a shared object must also be shared. And I don't know if a $res object can be shared. If it contains file handles or coderefs, or uses tie()s, than no. If its just an object with scalar members, then probably. Anything in-between will require the new shared_clone() capability (as you've used on $data above, for reasons that escape me, since you're just creating a hashref).

I suspect your app will need some refactoring to be able to use threads effectively, but as you've not posted any significant code, its a challenge to decipher your intent.


Perl Contrarian & SQL fanboy


Comment on Re: sharing complex data structures
Re^2: sharing complex data structures
by Anonymous Monk on Jul 08, 2008 at 14:04 UTC
    Perl: 5.10 (1003)
    threads: 1.71
    threads::shared: 1.23

    my asumption was correct, I need to somehow share my $res object. It's a http::response object so I'm sure of the best way to share it.

      Looks like you're running the latest stuff.

      IIRC, there's no file handles, coderefs, or ties in an HTTP::Response, so it may be as simple as share_clone($res).


      Perl Contrarian & SQL fanboy

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-12-29 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls