Modified PosixThreadFactory
Added explicit detached getter and setter
Modified PosixThreadFactory::~PThread:
Check for join failing and don't transition to detached_ state if it does. Potential thread-handle leak for
threads created joinable who aren't referenced by any external thread. Solution for now has to be
"DONT DO THAT", the clever approach doesn't always work.
Added ThreadFactoryTests.floodNThreads:
Loop M times for N threads where M x N is bigger than 32K to verify that detached threads can be created
ad infinitum.
Reviewed By: mcslee
Revert Plan: revertible
Test Plan: concurrency_test thread-factory passes
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665130 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Thread.h b/lib/cpp/src/concurrency/Thread.h
index 3e5964f..39ee816 100644
--- a/lib/cpp/src/concurrency/Thread.h
+++ b/lib/cpp/src/concurrency/Thread.h
@@ -75,7 +75,7 @@
/**
* Gets the thread's platform-specific ID
*/
- virtual id_t id() = 0;
+ virtual id_t getId() = 0;
/**
* Gets the runnable object this thread is hosting
@@ -104,7 +104,7 @@
static const Thread::id_t unknown_thread_id;
- virtual Thread::id_t currentThreadId() const = 0;
+ virtual Thread::id_t getCurrentThreadId() const = 0;
};
}}} // facebook::thrift::concurrency