File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/libipc/platform/posix Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,18 @@ class mutex {
8080 }
8181 }
8282
83+ static pthread_mutex_t const &zero_mem () {
84+ static const pthread_mutex_t tmp{};
85+ return tmp;
86+ }
87+
8388public:
8489 mutex () = default ;
8590 ~mutex () = default ;
8691
8792 static void init () {
8893 // Avoid exception problems caused by static member initialization order.
94+ zero_mem ();
8995 curr_prog::get ();
9096 }
9197
@@ -98,9 +104,8 @@ class mutex {
98104 }
99105
100106 bool valid () const noexcept {
101- static const char tmp[sizeof (pthread_mutex_t )] {};
102107 return (shm_ != nullptr ) && (ref_ != nullptr ) && (mutex_ != nullptr )
103- && (std::memcmp (tmp , mutex_, sizeof (pthread_mutex_t )) != 0 );
108+ && (std::memcmp (& zero_mem () , mutex_, sizeof (pthread_mutex_t )) != 0 );
104109 }
105110
106111 bool open (char const *name) noexcept {
You can’t perform that action at this time.
0 commit comments