source:
trunk/essentials/dev-lang/perl/ext/Thread/die.tx
| Last change on this file was 3181, checked in by , 19 years ago | |
|---|---|
| File size: 399 bytes | |
| Line | |
|---|---|
| 1 | BEGIN { |
| 2 | eval { require Config; import Config }; |
| 3 | if ($@) { |
| 4 | print "1..0 # Skip: no Config\n"; |
| 5 | exit(0); |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | use Thread 'async'; |
| 10 | |
| 11 | $t = async { |
| 12 | print "here\n"; |
| 13 | die "success"; |
| 14 | print "shouldn't get here\n"; |
| 15 | }; |
| 16 | |
| 17 | sleep 1; |
| 18 | print "joining...\n"; |
| 19 | eval { @r = $t->join; }; |
| 20 | if ($@) { |
| 21 | print "thread died with message: $@"; |
| 22 | } else { |
| 23 | print "thread failed to die successfully\n"; |
| 24 | } |
Note:
See TracBrowser
for help on using the repository browser.
