gcc 4.4.3 c89 pthreads
I use valgrind for checking memory errors.
I am just wondering if there is any tool for linux that can detect running threads that haven’t been terminated after the program finishes.
I am running a multi-thread application and need a tool to make sure all threads have finished.
Many thanks for any suggestions,
If the program has terminated (because the initial thread returned from
main(), some thread calledexit(), or a fatal signal was recieved by the process) then you are guaranteed that all threads have been terminated with extreme prejudice.If you want to write your program so that it ensures that all its threads have exited before
main()exits, then you need to loop over all your threads at the end ofmain(), callingpthread_join()on each one. (This also means that you shouldn’t create your threads detached, or detach them).