aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-26 05:42:53 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-02-26 05:42:53 +0000
commitc85a77a6ab0ef05c4a9a8554bf8c5e1c8687cc75 (patch)
tree45ff15530d24e3b41939398d3afaffe98e11b3ba /src
parent4f874c187beb3d185f7892887c8b13f356bf1fd6 (diff)
downloadgoogletest-c85a77a6ab0ef05c4a9a8554bf8c5e1c8687cc75.tar.gz
googletest-c85a77a6ab0ef05c4a9a8554bf8c5e1c8687cc75.tar.bz2
googletest-c85a77a6ab0ef05c4a9a8554bf8c5e1c8687cc75.zip
Simplifies ThreadStartSemaphore's implementation.
Diffstat (limited to 'src')
-rw-r--r--src/gtest-port.cc40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/gtest-port.cc b/src/gtest-port.cc
index 1c4c1bdc..b9504f56 100644
--- a/src/gtest-port.cc
+++ b/src/gtest-port.cc
@@ -75,46 +75,6 @@ const int kStdOutFileno = STDOUT_FILENO;
const int kStdErrFileno = STDERR_FILENO;
#endif // _MSC_VER
-#if GTEST_HAS_PTHREAD
-
-// ThreadStartSemaphore allows the controller thread to pause execution of
-// newly created test threads until signalled. Instances of this class must
-// be created and destroyed in the controller thread.
-ThreadStartSemaphore::ThreadStartSemaphore() : signalled_(false) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, NULL));
- GTEST_CHECK_POSIX_SUCCESS_(pthread_cond_init(&cond_, NULL));
- pthread_mutex_lock(&mutex_);
-}
-
-ThreadStartSemaphore::~ThreadStartSemaphore() {
- // Every ThreadStartSemaphore object must be signalled. It locks
- // internal mutex upon creation and Signal unlocks it.
- GTEST_CHECK_(signalled_);
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_));
- GTEST_CHECK_POSIX_SUCCESS_(pthread_cond_destroy(&cond_));
-}
-
-// Signals to all test threads to start. Must be called from the
-// controlling thread.
-void ThreadStartSemaphore::Signal() {
- signalled_ = true;
- GTEST_CHECK_POSIX_SUCCESS_(pthread_cond_signal(&cond_));
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
-}
-
-// Blocks until the controlling thread signals. Should be called from a
-// test thread.
-void ThreadStartSemaphore::Wait() {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_));
-
- while (!signalled_) {
- GTEST_CHECK_POSIX_SUCCESS_(pthread_cond_wait(&cond_, &mutex_));
- }
- GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_));
-}
-
-#endif // GTEST_HAS_PTHREAD
-
#if GTEST_OS_MAC
// Returns the number of threads running in the process, or 0 to indicate that