cpp: Fix a race/deadlock in ThreadManager
authorDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:20:01 +0000 (05:20 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:20:01 +0000 (05:20 +0000)
commit4cc0755b3382abc3e17ebba0ab4c2c78b9a8bbd7
treec8fcb43e67e5787772f737062e436d6e25ca8220
parent4e19f1914e49db4b7913ff0f5af8eec51caee875
cpp: Fix a race/deadlock in ThreadManager

When removing a task from the pending queue, we were only notifying a
blocked thread waiting to enqueue a task if the number of pending tasks
was exactly one less than the limit.  However, if two tasks are finished
at about the same time, this can result in two spots being freed up with
only one notify.  With this change, we always notify on task completion,
eliminating the race/deadlock.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920680 13f79535-47bb-0310-9956-ffa450edef68
lib/cpp/src/concurrency/ThreadManager.cpp