Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^3: Problem with Threaded Socket Server

by BrowserUk (Pope)
on Aug 18, 2013 at 20:47 UTC ( #1049950=note: print w/replies, xml ) Need Help??

in reply to Re^2: Problem with Threaded Socket Server
in thread Problem with Threaded Socket Server

Is it somehow possible to declare the $arduino object as shared, so the garba collection avoids it?

Not directly no. Each thread gets its own copy (actually not a fully copy, but a proxy to the real thing) of each shared variable; and that proxy is local to the thread and must be destroyed before the thread ends. In many cases, the appropriate action is to do nothing in the destroy unless this is the last copy of the handle.

In theory, there is a mechanism whereby module authors can make their modules thread-aware and possible thread-safe, by taking control of the cloning process by defining sub CLONE{ .. } in their packages; but the mechanism is barely described and I've never seen an example of anyone using it; so I cannot comment further on it. Besides which you'd either have to get the author of D::SP interested; or make your own changes.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049950]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-04-20 22:56 GMT
Find Nodes?
    Voting Booth?