From: "Brian Raven" <[email protected]> Subject: RE: Using Parallel::ForkManager with ActivePerl
>> -----Original Message----- >> From: [email protected] [mailto:activeperl- >> [email protected]] On Behalf Of Octavian Rasnita >> Sent: 07 January 2012 18:45 >> To: [email protected] >> Subject: Using Parallel::ForkManager with ActivePerl >> >> Hi, >> >> In the POD documentation of Parallel::ForkManager I read that it can >> share the $dbh db handle among threads, but when I tried it with >> ActivePerl, it gave the following error: >> >> "DBD::mysql::db clone failed: handle 2 is owned by thread 2944fc not >> current thread 24475cc (handles can't be shared between threads and >> your driver may need a CLONE method added) at..." >> >> Does this happen because Perl can't use threads under Windows, but only >> a kind of fork() as pseudo threads? ...although, Parallel::ForkManager >> docs say that it can also work with fork. > > I think you have that the wrong way round. Fork is implemented on win32 using > threads, which would explain the thread references in the error message. > > I could be wrong, but I can't imagine why using the same database connection > in parallel processes/threads would be a good idea, even if it were possible. > Could be very messy. In the POD documentation of DBIx::Connector (and not Parallel::ForkManager as I wrongly said before) I read: " * Thread Safety Unlike Apache::DBI or "connect_cached()", DBIx::Connector will create a new database connection if a new thread has been spawned." So, if a new connection is spawned automaticly, I guess there should be no problem. But it doesn't seem to work with ActivePerl under Windows. Octavian _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
