in reply to Re: shared complex scalars between threads
in thread shared complex scalars between threads
I had a poke at shared objects a little while ago.
You can share an arbitrarily complicated structure, with refs to arrays, hashes and scalars, to any depth you like. The tricky bit, I found, was that with refs to shared arrays and hashes you have to create an empty anonymous array/hash, mark it shared and then populate it.
With objects the problem was that this meant that the object maker had to know to construct a shared object.
As you say, the late model threads::shared claims:
shared_clone REFshared_clone takes a reference, and returns a shared version of its argument, preforming (sic) a deep copy ...
so, an object can be made shared after the event, now. But of the class adds new hashes or arrays to the object, without knowing they too need to be made shared, "fun" will ensue -- sure as eggs is eggs and this is not a pipe (also, no spoon). Not to mention the small issue of managing shared access to the object components.
I'd be interested to hear how that goes !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: shared complex scalars between threads
by BrowserUk (Patriarch) on Oct 16, 2008 at 01:32 UTC |