From e1f4f1f0d11c5e83647a2607b07bd3cce9eb1dce Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 20 Feb 2014 09:48:08 -0800 Subject: [PATCH] feat(util/thread): add atomic_uchar Signed-off-by: Leonardo de Moura --- src/util/thread.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/thread.h b/src/util/thread.h index 340cb119c..d328fd4b7 100644 --- a/src/util/thread.h +++ b/src/util/thread.h @@ -21,6 +21,7 @@ using std::mutex; using std::atomic; using std::atomic_bool; using std::atomic_ushort; +using std::atomic_uchar; using std::condition_variable; using std::lock_guard; using std::unique_lock; @@ -49,6 +50,7 @@ namespace chrono = boost::chrono; namespace this_thread = boost::this_thread; typedef atomic atomic_bool; typedef atomic atomic_ushort; +typedef atomic atomic_uchar; template T atomic_load(atomic const * a) { return a->load(); } template T atomic_fetch_add_explicit(atomic * a, T v, boost::memory_order mo) { return a->fetch_add(v, mo); } template T atomic_fetch_sub_explicit(atomic * a, T v, boost::memory_order mo) { return a->fetch_sub(v, mo); } @@ -92,6 +94,7 @@ public: friend T atomic_fetch_sub_explicit(atomic * a, T const & v, int ) { T r(a->m_value); a->m_value -= v; return r; } }; typedef atomic atomic_ushort; +typedef atomic atomic_uchar; typedef atomic atomic_bool; class thread { public: