Thread threads - croak (13 answers)
Opened by Cappu at 2009-07-31 19:45

murphy
 2009-08-01 14:30
#123804 #123804
User since
2004-07-19
1776 Artikel
HausmeisterIn
[Homepage]
user image
Gib doch einfach den Fehler als Resultat des Threads zurück:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env perl
use strict;
use warnings;

use threads;

sub worker_sub {
  die "Ups!\n";
}

my $worker = async { eval { worker_sub }; $@ };
my $error = $worker->join();

if ($error) {
  print "The worker thread produced an error: $error";
}
else {
  print "The worker thread completed successfully\n";
}
When C++ is your hammer, every problem looks like your thumb.

View full thread threads - croak