Modified facebook::thrift::concurrency::Monitor.wait:
authorMarc Slemko <marc@apache.org>
Tue, 22 May 2007 23:59:54 +0000 (23:59 +0000)
committerMarc Slemko <marc@apache.org>
Tue, 22 May 2007 23:59:54 +0000 (23:59 +0000)
commit3a3b53bc6eefa91ea60e5da2b2c91519ca1d9b2e
tree9bd43f88b0e1cb8959dbacc90a7d9babf16e10b3
parentf4f18ec514d42cec7a1368242015db1c3ad9da29
Modified facebook::thrift::concurrency::Monitor.wait:
        Throw TimedOutException on wait timeout so caller can distinguish between timeout and event.

Modified facebook::thrift::concurrency::PthreadThread.start:
        Throw SystemrResourceException on any pthread_* function call failure rather than asserting 0.

Added facebook::thrift::concurrency::Thread.id() and  facebook::thrift::concurrency::ThreadFactory.currentThreadId():
        Return thread-id of thread and current thread respectively.  Needed for reentrancy tests in ThreadManager

Added facebook::thrift::concurrency::ThreadManager.pendingTaskCountMaxN
Modified facebook::thrift::concurrency::ThreadManager.add():
        Now support a maximum pending task count and block if the current pending task count is max.
        If timeout is specified for add, TimedOutException is thrown if pending task count doesn't decrease
        in the timeout interval.  If add() is called by a ThreadManager worker thread and the task cannot
        be added, a TooManyPendingTasksException is thrown rather than blocking, since deadlocks can ensue
        if worker threads block waiting for works threads to complete tasks.

Reviewed By: mcslee, aditya

Revert Plan: revertible

Test Plan: concurrency/test/ThreadManagerTests.h
           run concurrency-test thread-manager

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665120 13f79535-47bb-0310-9956-ffa450edef68
15 files changed:
lib/cpp/src/concurrency/Exception.h
lib/cpp/src/concurrency/Monitor.cpp
lib/cpp/src/concurrency/Monitor.h
lib/cpp/src/concurrency/PosixThreadFactory.cpp
lib/cpp/src/concurrency/PosixThreadFactory.h
lib/cpp/src/concurrency/Thread.h
lib/cpp/src/concurrency/ThreadManager.cpp
lib/cpp/src/concurrency/ThreadManager.h
lib/cpp/src/concurrency/TimerManager.cpp
lib/cpp/src/concurrency/test/Tests.cpp
lib/cpp/src/concurrency/test/ThreadFactoryTests.h
lib/cpp/src/concurrency/test/ThreadManagerTests.h
lib/cpp/src/server/TThreadPoolServer.cpp
lib/cpp/src/server/TThreadPoolServer.h
test/threads/ThreadsServer.cpp