Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Threads works if not checked

by dave_the_m (Monsignor)
on Jun 18, 2014 at 23:05 UTC ( [id://1090373]=note: print w/replies, xml ) Need Help??


in reply to Threads works if not checked

You are setting $thread_endless_loop to the return value of the detach() method, which is not documented to return a value. Perhaps you meant:

my $thread_endless_loop = threads->create(\&endless_loop); if (!($thread_endless_loop)) { my $message = "Main " . __LINE__ . ": Error"; die("$message Cannot create a thread\n"); } $thread_endless_loop->detach();
Note also that $! will not have any meaningful value on failure to create a thread.

Dave.

Replies are listed 'Best First'.
Re^2: Threads works if not checked
by mnooning (Beadle) on Jun 19, 2014 at 13:20 UTC
    Yes, that was it. Good eyes!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-25 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found