in reply to Re^11: Slow evolution of Perl = Perl is a closed Word (thread decade)
in thread Slow evolution of Perl = Perl is a closed Word
Sure, launch your favorite OS monitor and enjoy:
Only explicitly shared data gets cloned on thread creationuse strict; use warnings; use threads; $| = 1; { package foo; sub run { threads->create(sub { sleep 10 }) } } { my @a; for (1..3e6) { push @a, "foo".rand } print "memory allocated\n"; sleep 10; print "now running threads\n"; foo->run; foo->run; sleep 10; }
No, it is exactly the opposite, everything but shared data gets cloned when a thread is created.
FYI: It is perfectly possible, and reasonably simple to do non-blocking IO on a pipe under win32 without using threads. You can't use select to do it directly, but with sufficient XS/internals skills, the nitty-gritty could be hidden under the covers of Perl's select.
So, can you point me in the right direction?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: Slow evolution of Perl = Perl is a closed Word (data cloning)
by tye (Sage) on Sep 04, 2007 at 17:38 UTC | |
|
Re^13: Slow evolution of Perl = Perl is a closed Word (thread decade)
by BrowserUk (Patriarch) on Sep 05, 2007 at 00:55 UTC |