in reply to Re: detach for threads
in thread detach for threads

O! Thanks I got it now. It ends not because the thread has a problem, but the main() ends.

Replies are listed 'Best First'.
Re^3: detach for threads
by zentara (Cardinal) on Nov 15, 2011 at 10:44 UTC
    As you experiment more with threads, you may see the warning " A thread exited while %d other threads were still running", that is caused by the main thread finishing before the spawned threads. Also watch out for using "exit" or "die" in thread code blocks, that will exit the entire program.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

        Yes. In this case however, the program exits, before the thread gets a chance to run, so no output, and no errors