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

Re: Threaded Perl: References to subroutines to threads

by renodino (Curate)
on Oct 09, 2007 at 15:21 UTC ( #643718=note: print w/replies, xml ) Need Help??


in reply to Threaded Perl: References to subroutines to threads

Does anybody now how I can call the subs that I pass to a thread?

Short answer: You can't.

Long answer: Thread::Queue is really nothing more than a threads::shared array. Which means any ref assigned to it must also be threads::shared. Since you're passing a coderef, it must be threads::shared...except threads::shared cannot be applied to coderefs.

See liverpole's response (Re: Threaded Perl: References to subroutines to threads) for an alternative.


Perl Contrarian & SQL fanboy
  • Comment on Re: Threaded Perl: References to subroutines to threads

Replies are listed 'Best First'.
Re^2: Threaded Perl: References to subroutines to threads
by Anonymous Monk on Oct 09, 2007 at 15:53 UTC

    Hi liverpole, renodino,

    thanks for you answers. I have already supposed that there are no shared coderefs so I will try the dispatcher way.

    Thanks for your help!

    Kind regards, Stephan

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://643718]
help
Chatterbox?
[Corion]: Meh. Some Open Source people get bought out by advertising firms to change their projects to include advertising. But nobody has approached me to buy out WWW::Mechanize ::$browser from me, to make the browsers launch an ad page ...
[Corion]: ... instead of about:blank, which the modules currently do at startup.
[Corion]: Maybe I'm too pricey. But I haven't received any offers at all ;-)
[Corion]: The ad hits from CPAN testers alone should bring in a pretty penny IMO. But maybe I misestimate the CPC that ads pay.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2017-07-24 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (354 votes). Check out past polls.