C thread pool implementation.