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 {
80
80
}
81
81
}
82
82
83
+ static pthread_mutex_t const &zero_mem () {
84
+ static const pthread_mutex_t tmp{};
85
+ return tmp;
86
+ }
87
+
83
88
public:
84
89
mutex () = default ;
85
90
~mutex () = default ;
86
91
87
92
static void init () {
88
93
// Avoid exception problems caused by static member initialization order.
94
+ zero_mem ();
89
95
curr_prog::get ();
90
96
}
91
97
@@ -98,9 +104,8 @@ class mutex {
98
104
}
99
105
100
106
bool valid () const noexcept {
101
- static const char tmp[sizeof (pthread_mutex_t )] {};
102
107
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 );
104
109
}
105
110
106
111
bool open (char const *name) noexcept {
You can’t perform that action at this time.
0 commit comments