Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Need some help. Currently the program is running 4 separate threads, pulling data off a queue to establish it's given task. The sub runs a while loop based off the queue's pending function. The threads all exit their while loops correctly. However after the sub should be done, the joins never occur. I can't quite figure out what's causing the lockup. Any help would be appreciated. Here's the censored version of the code:

sub smtpblast{ my $mdq= shift; my $pending= $mdq->pending; while($pending>0){ my $md= $mdq->dequeue_nb; my $user= $maildrop{"$md" . "user"}; my $pass= $maildrop{"$md". "pass"}; print "\n $user \n $pass \n"; my $mailer=Net::SMTP_auth->new('****'); $mailer->auth('Login', $user, $pass); $mailer->mail("$user"); $mailer->to('****'); my @data=("Subject: Test Messages from $user\n", "E-mail Blast message + from $user\n"); $mailer->data(@data); $mailer->datasend(); $mailer->dataend; $mailer->quit; $pending= $mdq->pending; } $threadid=threads->self; print "\n The process for thread $threadid is finished!\n"; } my $mdqueue=Thread::Queue->new(); $mdqueue->enqueue("md01", "md02", "md03", "md04", "md05", "md06", "md0 +7", "md08", "md09", "md10"); $thr1=threads->new(\&smtpblast, $mdqueue); $thr2=threads->new(\&smtpblast, $mdqueue); $thr3=threads->new(\&smtpblast, $mdqueue); $thr4=threads->new(\&smtpblast, $mdqueue); $thr1->join; print "\n Thread $thr1 joined! \n"; $thr2->join; print "\n Thread $thr2 joined! \n"; $thr3->join; print "\n Thread $thr3 joined! \n"; $thr4->join; print "\n Thread $thr4 joined! \n";

The program is for testing mail server latency. I have edited out server information and omitted the has that contains the logins. This is all the relevant pieces of code though.

In reply to Hanging Threads by WalkingZero

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 14:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found