More efficient locking in AbstractThreadPool.