home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / ext / Thread / die2.t < prev    next >
Text File  |  1999-07-20  |  315b  |  17 lines

  1. use Thread 'async';
  2.  
  3. $t = async {
  4.     sleep 1;
  5.     print "here\n";
  6.     die "success if preceded by 'thread died...'";
  7.     print "shouldn't get here\n";
  8. };
  9.  
  10. print "joining...\n";
  11. @r = eval { $t->join; };
  12. if ($@) {
  13.     print "thread died with message: $@";
  14. } else {
  15.     print "thread failed to die successfully\n";
  16. }
  17.