StampedPtr: use async-signal-safe assert
authorXiao Shi <xshi@fb.com>
Fri, 19 May 2017 14:23:29 +0000 (07:23 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 19 May 2017 14:37:39 +0000 (07:37 -0700)
Summary: Use SafeAssert instead of assert.

Reviewed By: nbronson

Differential Revision: D5085575

fbshipit-source-id: daeff427b9b1fc5dff6ea986d16a70364acd2dd7

folly/experimental/StampedPtr.h

index ac45c2102da5ff8e1b6fb18f83d8e1004e72b713..27432fdc6891754af205dbb078f0069fee5151f7 100644 (file)
@@ -16,7 +16,8 @@
 
 #pragma once
 
-#include <assert.h>
+#include <folly/SafeAssert.h>
+
 #include <stdint.h>
 
 namespace folly {
@@ -106,8 +107,8 @@ struct StampedPtr {
     auto shifted = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr))
         << kInternalStampBits;
     uint64_t raw = shifted | stamp;
-    assert(unpackPtr(raw) == ptr);
-    assert(unpackStamp(raw) == stamp);
+    FOLLY_SAFE_DCHECK(unpackPtr(raw) == ptr, "ptr mismatch.");
+    FOLLY_SAFE_DCHECK(unpackStamp(raw) == stamp, "stamp mismatch.");
     return raw;
   }