in reply to Re^3: In a multithreading Perl Code How to Exit one thread while outher thread keeps running ?
in thread In a multithreading Perl Code How to Exit one thread while outher thread keeps running ?

So you mean you want to keep part of your program running yet signal success to the calling program? That's not possible with threads.
Considering that variables can be shared in threads (which is about the only reason to use threads - if you don't need to communicate between threads, you might as well fork), returning status should be easy. Note that most implementation, sharing variables is the default in threads, but Perl does the opposite, but you can mark variables as shared.
  • Comment on Re^4: In a multithreading Perl Code How to Exit one thread while outher thread keeps running ?

Replies are listed 'Best First'.
Re^5: In a multithreading Perl Code How to Exit one thread while outher thread keeps running ?
by Corion (Patriarch) on Jul 06, 2009 at 13:54 UTC

    I've interpreted the problem as returning an exit status of 0 to the calling process, which is hard as long as you've got threads running, as a process consists of its threads, at least under Windows. I don't know if POSIX is different - at least POSIX threads share the same ID-space as processes, so the main thread might exit there and still leave other threads running, but I doubt that.

      The POSIX model is that when the primary thread ("main") ends, so do all the others. Perl follows this model.
      In theory the Windows model should allow other threads to complete without the primary thread, but the C RTL is not implemented in this way: exiting the primary thread calls ExitProcess().
      Fork ..... Yes this is what I am looking for. I got the solution. Thanks a lot everybody for all your help