mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 11:31:56 +01:00
Problem: selection of condition_variable_t implementation is confusing and not configurable
Solution: move configuration to build definition
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user