in reply to Re^2: panic: regfree data code 'ð' during global destruction. error when joining threads
in thread panic: regfree data code 'ð' during global destruction. error when joining threads

they? how would I get the main thread to exit without the A thread exited while 3 threads were running warning?

You can't exit the main thread without exiting all threads. If you need the behavior where the children continue on after the parent dies, you need "fork and exec", not threads.

If you just want to make sure all threads finish , at the end of your main program put something like

while (threads->list()) { $_->join() foreach threads->list(threads::joinable); sleep(1); }
that should wait for all threads to finish. Remeber, a thread cannot be joined unless it returns or hits the end of it's code block. In an emergency, you can use the fact that calling "exit" from any thread, will kill all threads.

I'm not really a human, but I play one on earth CandyGram for Mongo
  • Comment on Re^3: panic: regfree data code 'ð' during global destruction. error when joining threads
  • Download Code

Replies are listed 'Best First'.
Re^4: panic: regfree data code 'ð' during global destruction. error when joining threads
by somekindafreak (Acolyte) on Jun 11, 2008 at 23:59 UTC
    but then I'd hit the same panic I'm trying to avoid above. I already know how to join all my threads.
      Sounds like you have a bad bug in your program. You might want to look at the later nodes in Threads memory consumption is infinite where the topic of reusing threads is discussed. I'm just guessing, because you only give a brief description of your code; but what is probably happening, is that during all those object additions to the threads, something is getting crosslinked, and won't get freed up due to the refcount problem ( search for refcount for the gory details). Then when you try to join a properly terminated thread(it must return before being joined), there is a thread safety problem.

      The warning is harmless, and if your code runs fine, you just might want to let it go, or think about your design for object-thread interaction. The one thing to watch for is an unusual memory gain while running the program. That "data code o" is laying around wasting memory and causing a thread safety problem.

      You said in your original node "This system has dozens of objects, each which may need to reference data from other objects. . This is probably the source of your threading bug. Many better minds than mine have tried to solve the refcount dilemma, and no success yet. I hope Perl6 has some better magic in this regard.


      I'm not really a human, but I play one on earth CandyGram for Mongo