Roger,

Steve is right. As a user of SQLite, I know that the DB handles are not
thread safe, and you will need to move the opening context into each of
the threads, not globally copying it. Keep in mind that there may be
certain delays in place if the 2 threads access the DB at the same time.
I would also suggest making _very_ sure you are using the latest SQLite
in your DBI/DBD.

I've got a program that runs 3 intercommunicating threads, but only one
of which accesses the DB at any given time, and only for short periods.
But, I know it can be done from multiple threads at once. Just be
careful. And, if possible, refactor code so that it runs only in one
thread.

Jason P.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Lloyd, Steve
Sent: Thursday, April 06, 2006 4:34 PM
To: Roger Mayfield
Cc: perl-win32-gui-users@lists.sourceforge.net
Subject: RE: [perl-win32-gui-users] Using Threads with Win::32 and
Net::IRC

The only way I have got this to work is to open the database connection
in the thread.

Steve Lloyd
http://www.basgetti.com

 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Roger Mayfield
Sent: Thursday, April 06, 2006 2:23 PM
Cc: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Using Threads with Win::32 and Net::IRC

Okay, I've almost got Win32::GUI working with Net::IRC using threads. 
I'm getting an error though and I have no idea what it means:

thread failed to start: DBD::SQLite::db table_info failed: handle 2 is
owned by thread 2240bc not current thread 2270a2c (handles can't be
shared between threads and your driver may need a CLONE method added) at

D:\test.pl line 1262.

The database handle in question is in fact global and named in the
beginning of my script. I would like to have access to this database as
it contains information pertaining to both the GUI and the IRC
connection. As you can see, my script is well over 1300 lines and it
would be messy to post it all in an email (Not to mention, my coding is
very messy since I'm quite new to Perl). Line 1262 is actually:

my $sth=$db->table_info();

In which I'm trying to test if a table in fact does exist and if not
then create it. I call this sub many times from both threads and I've
even tried creating two different subs, but the problem isn't with the
sub, it's with the database handle that I've created globally before the

sub-thread is created. Any ideas? ANYTHING is appreciated considering I
have NO idea what the hell I'm doing, lol. Or should I try a different
Mailing list?


Roger Mayfield


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language that extends applications into web and mobile media. Attend the
live webcast and join the prime developer group breaking into this new
coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

This email, and any files previous email messages included with it, may
contain confidential and/or privileged material. If you are not the
intended recipient please contact the sender and delete all copies.




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language that extends applications into web and mobile media. Attend the
live webcast and join the prime developer group breaking into this new
coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to