in reply to Kill and free the memory Never ending threads from main
But when I am exiting the threads are still running I want to free all the space occupied by this threads and then exit from the script
When your main thread exits; any other threads will be killed and cleaned up automatically.
If you wish to suppress this oh so useful informational message:
C:\Downloaded\testp>perl -Mthreads -E"async{ sleep; }; say 'hi & bye'; hi & bye Perl exited with active threads: 1 running and unjoined 0 finished and unjoined 0 running and detached
Just detach the threads:
C:\Downloaded\testp>perl -Mthreads -E"async{ sleep; }->detach; say 'hi + & bye';" hi & bye
|
|---|