Re: Threading within another thread
[email protected] (Francesco Nidito) Fri, 29 Jan 2010 11:05:27 +0000
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <[email protected]> |
It is possible to spawn a thread from inside another thread but
remember that the thread will belong to the process and not to the
thread that spawned it (as usually with threads...).
use threads;
sub InternalThread {
# do something...
}
sub ExternalThread {
# do something...
my $it =3D threads->create(\&InternalThread);
# do something else in parallel with InternalThread...
$it->join();
# do the rest
}
# main()
my $et =3D threads->create(\&ExternalThread);
$et->join();
On Thu, Jan 28, 2010 at 6:42 PM, Danny Wong (dannwong)
<[email protected]> wrote:
> Hi Perl Thread GURUS,
> =A0 =A0 =A0 =A0Is it possible to run threads within another thread? Is so=
, any
> example on how to do it? Thanks.
>