CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
# "now" binding is necessary to prevent deadlocks in C++ static initialization code
LDFLAGS="$LDFLAGS -z now"
+ # Destroying locked mutexes, condition variables being waited
+ # on, etc. are undefined behavior on Solaris, so we set it as
+ # such here.
+ AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
;;
*-apple-darwin*)
# Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
+#include <config.h>
+
#include <gtest/gtest.h>
#include <util/threads/sync.h>
#endif // ENABLE_DEBUG
+#ifndef HAS_UNDEFINED_PTHREAD_BEHAVIOR
// Destroying a locked mutex is a bad idea as well
-#ifdef EXPECT_DEATH
TEST(MutexTest, destroyLocked) {
if (!isc::util::unittests::runningOnValgrind()) {
- EXPECT_DEATH({
+ EXPECT_DEATH_IF_SUPPORTED({
Mutex* mutex = new Mutex;
new Mutex::Locker(*mutex);
delete mutex;
}, "");
}
}
-#endif
+#endif // !HAS_UNDEFINED_PTHREAD_BEHAVIOR
// In this test, we try to check if a mutex really locks. We could try that
// with a deadlock, but that's not practical (the test would not end).