a dynamic thread pool in c