pthreads: better thread-list protection, pooled memory allocation