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

or another solution for cleaning up all my objects/references so that the threads can join without this error?

Without seeing your code, when you get into refcount problems with threads, it's best to reuse your threads. If you try to create threads, with create/join cycles, and an object isn't threadsafe, the object may hang around in memory and bite you later. The best approach, is to reuse threads by cleaning out the temp data from it's objects, and filling them with fresh data for the objects. You only need to join the threads when you exit the program.

I know this sounds like a hassle, but it works reliably.... reuse your threads.


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

Replies are listed 'Best First'.
Re^2: panic: regfree data code 'ð' during global destruction. error when joining threads
by Anonymous Monk on Jun 11, 2008 at 14:39 UTC
    I can reuse the threads, but eventually they have to join, dont they? how would I get the main thread to exit without the

    A thread exited while 3 threads were running, <STDIN> line 1.

    message?

      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
        but then I'd hit the same panic I'm trying to avoid above. I already know how to join all my threads.