implemented lock guard for thread pool