Hi
first of all, thanks for the excellent code, I been using it for quite sometime and it has proved to be quite robust on all platforms i tested out with !
the reason i am writing this bug report is because i think there is a small leak happening on the lines of http://tread.wordpress.com/2007/02/26/valgrind-and-pthread_create-memory-leak/ . Though i might be totally wrong and not using the library in the correct manner.
i use the tinythread++ with matlab's c interface and what was happening is after sometime the virtual memory usage got out of hand and the program crashed (what the program did was in a loop start->spawn number of threads->stop). after running valgrind, checking via pmap and writing a test case it seems that the something with pthreads was being left on the stack and that caused lots of page faults and thus an increase in virtual memory.
i guess it has something to do with pthread_exit(NULL) not being in the callee function perhaps?
attached file compiled as g++ mex_example.cpp tinythread/tinythread.cpp -lpthread
valgrind check done as valgrind -v --error-limit=no --tool=memcheck --track-origins=yes --leak-check=full --show-reachable=yes --num-callers=50 ./a.out
tinythread++ version in matlab after running it for 100 iteration causes a virtual memory size of 77G whereas pthread version doesot leak any memory. BTW same with the c version, if you put a getchar at the end it seems to still increase memory using even when delete is used..
thanks again.
test case file