lichao
2021-03-29 5657dca25451cfb63a90a3908db0c464fe3f343d
src/msg.cpp
@@ -17,7 +17,7 @@
 */
#include "msg.h"
namespace bhome_shm {
namespace bhome_msg {
   
bool MsgMetaV1::Parse(const void *p)
@@ -59,9 +59,20 @@
}
void Msg::FreeFrom(SharedMemory &shm)
int Msg::Release(SharedMemory &shm)
{
    if (IsCounted()) {
        const int n = count_->Dec();
        if (n != 0) {
            return n;
        }
    }
    // free data
    shm.Dealloc(ptr_);
    ptr_ = 0;
    shm.Delete(count_);
    count_ = 0;
    return 0;
}
} // namespace bhome_shm
} // namespace bhome_msg