Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76294 - in trunk/boost/thread: . detail
From: vicente.botet_at_[hidden]
Date: 2012-01-03 16:13:00


Author: viboes
Date: 2012-01-03 16:12:59 EST (Tue, 03 Jan 2012)
New Revision: 76294
URL: http://svn.boost.org/trac/boost/changeset/76294

Log:
Thread Towards #6273 - Add cv_status enum class and use it on the conditions wait functions
Added:
   trunk/boost/thread/cv_status.hpp (contents, props changed)
Text files modified:
   trunk/boost/thread/detail/config.hpp | 23 +++++++++++++++++++++++
   1 files changed, 23 insertions(+), 0 deletions(-)

Added: trunk/boost/thread/cv_status.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/thread/cv_status.hpp 2012-01-03 16:12:59 EST (Tue, 03 Jan 2012)
@@ -0,0 +1,26 @@
+// cv_status.hpp
+//
+// Copyright (C) 2011 Vicente J. Botet Escriba
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_THREAD_CV_STATUS_HPP
+#define BOOST_THREAD_CV_STATUS_HPP
+
+#include <boost/thread/detail/config.hpp>
+
+namespace boost
+{
+
+ // enum class cv_status;
+ BOOST_DECLARE_STRONG_ENUM_BEGIN(cv_status)
+ {
+ no_timeout,
+ timeout
+ };
+ BOOST_DECLARE_STRONG_ENUM_END(cv_status)
+}
+
+#endif // header

Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2012-01-03 16:12:59 EST (Tue, 03 Jan 2012)
@@ -19,6 +19,29 @@
 #endif
 #endif
 
+#ifdef BOOST_NO_SCOPED_ENUMS
+#define BOOST_DECLARE_STRONG_ENUM_BEGIN(x) \
+ struct x { \
+ enum enum_type
+
+#define BOOST_DECLARE_STRONG_ENUM_END(x) \
+ enum_type v_; \
+ inline x() {} \
+ inline x(enum_type v) : v_(v) {} \
+ inline operator int() const {return v_;} \
+ friend inline bool operator ==(x lhs, int rhs) {return lhs.v_==rhs;} \
+ friend inline bool operator ==(int lhs, x rhs) {return lhs==rhs.v_;} \
+ friend inline bool operator !=(x lhs, int rhs) {return lhs.v_!=rhs;} \
+ friend inline bool operator !=(int lhs, x rhs) {return lhs!=rhs.v_;} \
+ };
+
+#define BOOST_STRONG_ENUM_NATIVE(x) x::type
+#else // BOOST_NO_SCOPED_ENUMS
+#define BOOST_DECLARE_STRONG_ENUM_BEGIN(x) enum class BOOST_SYMBOL_VISIBLE x
+#define BOOST_DECLARE_STRONG_ENUM_END(x)
+#define BOOST_STRONG_ENUM_NATIVE(x) x
+#endif // BOOST_NO_SCOPED_ENUMS
+
 #if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
 # pragma warn -8008 // Condition always true/false
 # pragma warn -8080 // Identifier declared but never used


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk