#!/usr/bin/perl -l use strict; use warnings; no warnings 'uninitialized'; use threads; use Time::Out qw(timeout); my (@t) = map( async( sub { my $tid = 'threads'->tid; my $worktime = shift @_; print "Thread $tid started with a worktime of $worktime"; eval { sub test { timeout 10, @_ => sub { print "$_[0]"; }; } }; print "Thread $tid ended ", $@ ? " with error: $@" : "norm +ally"; }, 2 * $_ + $ARGV[0]), 1..4); $_->join foreach (@t);
In reply to Re: Threads Timeout
by Khen1950fx
in thread Threads Timeout
by Gary Yang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |