in reply to Re: If I am tied to a db and I join a thread, program chrashes
in thread If I am tied to a db and I join a thread, program chrashes

Thank you esteemed jethro for your insight. I did test 4 threads running the same code at the same time (obviously with no tie to a database) and while memory use went up, the total time was about 1.5 times a single run, not the expected 4 times longer i would have without threads. CPU usage went up to 95%+ instead of 25% that was used without threads.

Plus I am back on track thanks to monk clinton, who told me to tie to the database inside the thread, one tie for each thread. Seems to work so far.

And thanks for the tip on MLDBM::Sync. I am using it without problems so far. lance
  • Comment on Re^2: If I am tied to a db and I join a thread, program chrashes

Replies are listed 'Best First'.
Re^3: If I am tied to a db and I join a thread, program chrashes
by Anonymous Monk on Jul 06, 2009 at 13:07 UTC
    Hello Monks and lance0r I am facing the problem with a similar situation but when I want to connect with different schemas on the same machine. Actually I need to run perl reports but need to run them parallel with different schemas. Would that thread make any problem? Initially i was planning to use fork() inbuilt function but then we changed to 'use thread' but now its giving me segmentation fault error. Can anyone please help me out here?

      If your question is about DBI, read the discussion of Threads and Thread Safety. If it's not about DBI, it's even less clear to me about what your question is. But in general, you will have much more luck in launching separate programs instead of trying to use fork() or threads to run DBI things in parallel.