Problem: selection of condition_variable_t implementation is confusing and not configurable

Solution: move configuration to build definition
This commit is contained in:
Simon Giesecke
2019-02-11 07:05:04 -05:00
parent bfb092c3ec
commit 120edd9809
5 changed files with 101 additions and 33 deletions

View File

@@ -35,25 +35,7 @@
// Condition variable class encapsulates OS mutex in a platform-independent way.
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#if defined(_MSC_VER)
#if _MSC_VER >= 1800
#define _SUPPORT_CONDITION_VARIABLE 1
#else
#define _SUPPORT_CONDITION_VARIABLE 0
#endif
#else
#if _cplusplus >= 201103L
#define _SUPPORT_CONDITION_VARIABLE 1
#else
#define _SUPPORT_CONDITION_VARIABLE 0
#endif
#endif
// Condition variable is supported from Windows Vista only, to use condition variable define _WIN32_WINNT to 0x0600
#if _WIN32_WINNT < 0x0600 && !_SUPPORT_CONDITION_VARIABLE
#if defined(ZMQ_USE_CV_IMPL_NONE)
namespace zmq
{
@@ -79,16 +61,12 @@ class condition_variable_t
};
}
#else
#elif defined(ZMQ_USE_CV_IMPL_WIN32API)
#if _SUPPORT_CONDITION_VARIABLE || defined(ZMQ_HAVE_WINDOWS_TARGET_XP)
#include <condition_variable>
#endif
#include "windows.hpp"
namespace zmq
{
#if !defined(ZMQ_HAVE_WINDOWS_TARGET_XP) && _WIN32_WINNT >= 0x0600
class condition_variable_t
{
public:
@@ -121,7 +99,14 @@ class condition_variable_t
condition_variable_t (const condition_variable_t &);
void operator= (const condition_variable_t &);
};
#else
}
#elif defined(ZMQ_USE_CV_IMPL_STL11)
#include <condition_variable>
namespace zmq
{
class condition_variable_t
{
public:
@@ -158,13 +143,9 @@ class condition_variable_t
condition_variable_t (const condition_variable_t &);
void operator= (const condition_variable_t &);
};
#endif
}
#endif
#elif defined ZMQ_HAVE_VXWORKS
#elif defined(ZMQ_USE_CV_IMPL_VXWORKS)
#include <sysLib.h>
@@ -248,7 +229,8 @@ class condition_variable_t
const condition_variable_t &operator= (const condition_variable_t &);
};
}
#else
#elif defined(ZMQ_USE_CV_IMPL_PTHREADS)
#include <pthread.h>
@@ -344,5 +326,4 @@ class condition_variable_t
#endif
#endif