|Syntactic Confectionery Delight|
Re^3: Sharing globsby renodino (Curate)
|on Nov 02, 2007 at 17:21 UTC||Need Help??|
Nice piece of detective work!
I'm troubled by this statement:
And once a shared glob has been stored in a hash value, it looses some or all of its magic.
Presumably, the assignment to the 'httpd_daemon' element in the shared *HASH is going thru the sharedsv_elem_mg_STORE() method, which should end up in sharedsv_scalar_store(). Have you tried sprinkling the latter with printf's to see what path it takes ? I'd assume its handled as an RV, but maybe something else is going on...( I have vague memories of a recent p5p posting regarding a threads::shared patch to address chained magic, but can't seem to find anything in the changelog...but make sure you're using the latest version)
FWIW I'm personally still not comfortable with just dup()'ing; I've experienced too many weird behaviors with both block and (esp.) stream I/O when things get dup()'ed. I'm also concerned about the possibility of piling up dup's if an app has a master thread repeatedly/arbitrarily passing file handles around to worker threads. But if the sharing magic can be fixed, then that problem can presumably be fixed by stealing the clone code for handles, and then (a) checking if the file already has context in the recving thread and (b) cloning the state into the recving thread at that point if it doesn't.
(BTW: maybe this dialogue needs to be moved to the ithreads maillist ?)
Perl Contrarian & SQL fanboy