in reply to mysqlPP has no driver CLONE() function so is unsafe threaded

Ideas how to solve this?

That really depends upn what "this" is. Ie. What are you currently trying to achieve by sharing a DB handle?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
  • Comment on Re: mysqlPP has no driver CLONE() function so is unsafe threaded

Replies are listed 'Best First'.
Re^2: mysqlPP has no driver CLONE() function so is unsafe threaded
by Ace128 (Hermit) on Aug 02, 2005 at 03:29 UTC
    Seems like a missed DB handle was created at a place it shouldn't be at...

      It's not clear to me from the above whether you have solved your problem or not?

      The basic gist of the problem (from reading the error message you posted), is that your code created a db handle in one thread and then attempted to use from another.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
        Well, its kinda solved... However, this means that I cant have a "global" db connection? What about this situation:
        my $dbh = DBI->connect("dbi:mysql:$db:$host", "$db_user", "$db_passwor +d", {RaiseError => 0, PrintError => 0} ) # We do the error check. May +be we dont wanna die if error! or errTrap("Cannot connect to the datab +ase"); threads->create(&dbUpdate()))->join; threads->create(&anotherThread()))->join; sub dbUpdate() { while(1) { do som db stuff when wanted } } sub anotherThread() { do stuff on shared variables that the db uses... }
        Guess the solution is to have the db obj in the dbUpdate function ONLY...