diff options
author | Copybara-Service <copybara-worker@google.com> | 2023-09-11 19:46:26 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-09-11 19:46:26 (GMT) |
commit | eab0e7e289db13eabfc246809b0284dac02a369d (patch) | |
tree | e21a6f38eb396f8e229c70e78cfc80721ea459b9 /googletest | |
parent | 8a6feabf04bec8fb125e0df0ad1195c42350725f (diff) | |
parent | b86bf840d1d562d12efd4e0790ce14455f5fa271 (diff) | |
download | googletest-eab0e7e289db13eabfc246809b0284dac02a369d.zip googletest-eab0e7e289db13eabfc246809b0284dac02a369d.tar.gz googletest-eab0e7e289db13eabfc246809b0284dac02a369d.tar.bz2 |
Merge pull request #4365 from tanzislam:fix-thread-count-after-thread-creation
PiperOrigin-RevId: 564472305
Change-Id: I8db9bc0ba0768e7ab9c67f36d9db87edbbf14f10
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/test/googletest-port-test.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index e0793ba..8d21026 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -296,7 +296,7 @@ void* ThreadFunc(void* data) { TEST(GetThreadCountTest, ReturnsCorrectValue) { size_t starting_count; size_t thread_count_after_create; - size_t thread_count_after_join; + size_t thread_count_after_join = 0; // We can't guarantee that no other thread was created or destroyed between // any two calls to GetThreadCount(). We make multiple attempts, hoping that @@ -316,9 +316,9 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex); ASSERT_EQ(0, pthread_attr_destroy(&attr)); ASSERT_EQ(0, status); - } - thread_count_after_create = GetThreadCount(); + thread_count_after_create = GetThreadCount(); + } void* dummy; ASSERT_EQ(0, pthread_join(thread_id, &dummy)); |