From d17450bd7bc9fd5e98e8e2f00999caffe2e301a6 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 26 三月 2021 17:43:09 +0800
Subject: [PATCH] test thread/fork speed; reset msg after release.

---
 src/msg.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/msg.cpp b/src/msg.cpp
index 66eec4b..9883246 100644
--- a/src/msg.cpp
+++ b/src/msg.cpp
@@ -59,7 +59,7 @@
 
 }
 
-int Msg::Release(SharedMemory &shm) const
+int Msg::Release(SharedMemory &shm) 
 {
     if (IsCounted()) {
         const int n = count_->Dec();
@@ -69,7 +69,9 @@
     }
     // free data
     shm.Dealloc(ptr_);
+    ptr_ = 0;
     shm.Delete(count_);
+    count_ = 0;
     return 0;
 }
 

--
Gitblit v1.8.0