Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Threads weirdness

by Corion (Patriarch)
on Jul 06, 2009 at 14:12 UTC ( [id://777555]=note: print w/replies, xml ) Need Help??


in reply to Threads weirdness

Passing around objects among threads is fraught with potential for errors. I think the basic principle is that you'll get a copy unless you declare something as explicitly :shared. See threads and threads::shared. Personally, I'd try to decouple the scheduler from the worker(s) and have a queue in each direction to pass commands forth and receive the status (+data) back from the worker(s).

Replies are listed 'Best First'.
Re^2: Threads weirdness
by reasonablekeith (Deacon) on Jul 06, 2009 at 14:50 UTC
    Thanks Corion,

    The only thing that changes in the component object is the last_run_time value, so I guess you're saying I can handle that in the main thread instead of it being managed by the object, and that might fix my problem?

    I still find it very weird, as (disregarding what's in the object), that scalar ref value changes from one line to the next.

    ---
    my name's not Keith, and I'm not reasonable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-25 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found