Skip to content

Commit

Permalink
fix issue google#1521
Browse files Browse the repository at this point in the history
use default constructor of pthread_t in order to initialize mutex
  • Loading branch information
leissa committed Mar 28, 2018
1 parent 9dde7c4 commit 3e6a979
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -2093,13 +2093,8 @@ class MutexBase {
extern ::testing::internal::MutexBase mutex

// Defines and statically (i.e. at link time) initializes a static mutex.
// The initialization list here does not explicitly initialize each field,
// instead relying on default initialization for the unspecified fields. In
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
// This allows initialization to work whether pthread_t is a scalar or struct.
// The flag -Wmissing-field-initializers must not be specified for this to work.
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false, pthread_t() }

// The Mutex class can only be used for mutexes created at runtime. It
// shares its API with MutexBase otherwise.
Expand Down

0 comments on commit 3e6a979

Please sign in to comment.