(aka. Joining the "Perl 5.8.2 threads are much worse" cult)
I would just like to add something to the two previous meditations regarding Perl 5.8.2 threading being much worse than earlier 5.8 versions but started a new meditation as it's my first one :) Ok, that, and I'm dealing with databases.
Certain people may have noticed that I am having a few troubles with Perl 5.8.2, threading and Oracle 9i database connections under Solaris 8 (for sparc).
After recent advice from a member of the Perl DBI mailing list I built Perl 5.8.0 with threading support and compared the results against Perl 5.8.2 threads.
Code snippet 1:
#!/opt/bin/perl use threads; use DBI; @threads; printf "Starting thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $threads[$i] = new threads(\&do_db); } printf "\n"; printf "Joining thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $thread = $threads[$i]; $thread->join; } printf "\n"; sub do_db { my $dbh = DBI->connect("dbi:Oracle:host=localhost;sid=testdb1" +, "user1", "pass1") || die $!; }
under 5.8.2 started all threads but then core dumped when trying to join. Under 5.8.0 this code seems to work fine.
Code snippet 2:
#!/opt/bin/perl use threads; use DBI; our $orashr : shared = '' ; @threads; printf "Starting thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $threads[$i] = new threads(\&do_db); } printf "\n"; printf "Joining thread "; for ($i = 0; $i < 50; $i++) { printf "$i "; $thread = $threads[$i]; $thread->join; } printf "\n"; sub do_db { my $dbh = DBI->connect("dbi:Oracle:host=localhost;sid=testdb1" +, "user1", "pass1", { ora_dbh_share => \$orashr} ) || die $!; }
under 5.8.2 core dumped after only starting a handful of threads. Under 5.8.0 it starts all the threads fine but then dumps core when trying to join them.
I am most interested in the latter code and as it still dumps core Perl 5.8 threads are of no use to me. Yet. However, I believe this does highlight one thing - the behaviour under 5.8.0 threads compared to 5.8.2 threads is better. Things either don't crash, or crash at a later point, but things work better.
I wonder why threads in 5.8.2 are causing so much bother...
== fx, Infinity Is Colourless
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I too don't like Perl 5.8.2 threads
by mpeppler (Vicar) on Jan 06, 2004 at 20:15 UTC | |
|
Re: I too don't like Perl 5.8.2 threads
by mpeppler (Vicar) on Jan 06, 2004 at 22:54 UTC | |
|
Re: I too don't like Perl 5.8.2 threads
by mpeppler (Vicar) on Jan 06, 2004 at 19:21 UTC | |
|
Re: I too don't like Perl 5.8.2 threads
by castaway (Parson) on Jan 06, 2004 at 17:55 UTC | |
by fx (Pilgrim) on Jan 06, 2004 at 21:20 UTC |