The context (scalar or list) of the thread creation is also the context for join(). This means that if you intend to return an array from a thread, you must use "my ($thread) = threads-"new(...)>, and that if you intend to return a scalar, you must use "my $thread = ...".
Applied to your example, this would mean:
($thr) = threads->new(\&sub1);
Liz
Update:
Apparently the above documentation is in 5.8.1, and not in 5.8.0. I guess you could say it's one more documentation bug that was fixed by 5.8.1. Sorry for the possible confusion.
In reply to Re: threads->join
by liz
in thread threads->join
by powerman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |