Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

thread wont call subroutine

by deadpickle (Pilgrim)
on Jun 02, 2009 at 21:31 UTC ( [id://767790]=perlquestion: print w/replies, xml ) Need Help??

deadpickle has asked for the wisdom of the Perl Monks concerning the following question:

I have a program that uses threads. And within these threads I tried to call a subroutine by simply calling &sendxml. When I do this the program does not call the subroutine and continues through the thread. Why is this? Is this a known issue? The thread is started by: my $recv = threads->new(\&recvxml);

Replies are listed 'Best First'.
Re: thread wont call subroutine
by almut (Canon) on Jun 02, 2009 at 21:39 UTC

    Don't think this a known issue, so it would help if you could post a minimal (but complete) sample program that exhibits the problem...

Re: thread wont call subroutine
by carlin (Beadle) on Jun 02, 2009 at 22:20 UTC
    I'll take a stab in the dark here; are you sure the thread isn't running the subroutine but the program is exiting before it completes?

    Try calling $recv->join; below your thread declaration.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found