From ccf72bb0b8aa9c421bb2964acca2dcd868d10a94 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期二, 18 五月 2021 11:41:46 +0800 Subject: [PATCH] use more rational node timeout, 60s. --- src/bh_util.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bh_util.h b/src/bh_util.h index a1c0d84..15ffeb0 100644 --- a/src/bh_util.h +++ b/src/bh_util.h @@ -92,6 +92,8 @@ inline void PutInt(void *p, uint32_t u) { Put32(p, u); } inline void PutInt(void *p, uint64_t u) { Put64(p, u); } +constexpr uint64_t MaskBits(int nbits) { return (uint64_t(1) << nbits) - 1; } + class ExitCall { typedef std::function<void(void)> func_t; @@ -155,9 +157,9 @@ } protected: - static inline T &GetData() + static inline T &GetData(const std::string &msg = "Must set data before use!") { - if (!ptr()) { throw std::string("Must set ShmMsg shm before use!"); } + if (!ptr()) { throw std::logic_error(msg); } return *ptr(); } -- Gitblit v1.8.0