Hello Mike Percy,

I'd like you to do a code review.  Please visit

    http://gerrit.cloudera.org:8080/5517

to review the following change.

Change subject: threadpool: avoid calling task destructors while holding lock
......................................................................

threadpool: avoid calling task destructors while holding lock

Currently, the ThreadPool calls task's destructors while holding its
internal lock. This has two issues:

1) While it's not a great practice, some destructors themselves acquire
locks. This can create lock cycles if those same locks are ever held
concurrently with a submission to the threadpool.

2) Even well-written destructors can be heavy-weight, eg if they free a
large graph of dependent objects. We should not block the threadpool's
progress while running these destructors.

This fixes the issue by being more explicit about where tasks are freed,
both in the Shutdown() code path as well as the normal task dispatch
code.

Change-Id: I4cdc38c7db0a6a7fd640d82895ecaebe0718ee98
---
M src/kudu/util/threadpool-test.cc
M src/kudu/util/threadpool.cc
M src/kudu/util/threadpool.h
3 files changed, 48 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/17/5517/1
-- 
To view, visit http://gerrit.cloudera.org:8080/5517
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cdc38c7db0a6a7fd640d82895ecaebe0718ee98
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Mike Percy <[email protected]>

Reply via email to