Think about Loose Coupling | |
PerlMonks |
Running subs ,,in background''by lRem (Scribe) |
on Nov 23, 2005 at 20:18 UTC ( [id://511233]=perlquestion: print w/replies, xml ) | Need Help?? |
lRem has asked for the wisdom of the Perl Monks concerning the following question:
Greetings.
I have an app that collects some data every few seconds, and once about a minute draws graph of them. The problem is that drawing the graph sometimes takes enough time to lose a round of data collection. So I wanted to run the drawing sub asynchronously and decided, that this will be easier done with ithreads than with forks. As it doesn't need any communication with the main program after getting the argumets, the snippet looks real easy: But this creates problems. It happened to die with: *** glibc detected *** double free or corruption (fasttop): 0xb7e8d7d8 ***. It also sometimes happens, that the draw sub gets malformed args, what hasn't happened since months. But ultimately, even if everything ticks otherwise, after executing draw a few times the program just exits without goodbye! Now I don't know, is it something fundamental that I've missed, or the draw function somehow isn't thread safe, or ufo decided to disturb me. For further detail: in fact in some moments there can be as much as 35 drawing threads created in a short time, but it never really stood up to even ten. The draw function is RRDs::graph, and I'm using perl 5.8.6.
-- Someday, people who know how to use computers will rule over those who don't. And there will be a special name for them: secretaries. -Dilbert quote
Back to
Seekers of Perl Wisdom
|
|