Use ZMQ on MacOS (#46)

This commit is contained in:
Paweł Goliński 2020-05-21 01:11:48 +02:00 committed by GitHub
parent 01cdf832c8
commit 67fae6afcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -2,9 +2,15 @@
#include "impl_zmq.hpp"
#include "impl_msgq.hpp"
#ifdef __APPLE__
const bool MUST_USE_ZMQ = true;
#else
const bool MUST_USE_ZMQ = false;
#endif
Context * Context::create(){
Context * c;
if (std::getenv("ZMQ")){
if (std::getenv("ZMQ") || MUST_USE_ZMQ){
c = new ZMQContext();
} else {
c = new MSGQContext();
@ -14,7 +20,7 @@ Context * Context::create(){
SubSocket * SubSocket::create(){
SubSocket * s;
if (std::getenv("ZMQ")){
if (std::getenv("ZMQ") || MUST_USE_ZMQ){
s = new ZMQSubSocket();
} else {
s = new MSGQSubSocket();
@ -60,7 +66,7 @@ SubSocket * SubSocket::create(Context * context, std::string endpoint, std::stri
PubSocket * PubSocket::create(){
PubSocket * s;
if (std::getenv("ZMQ")){
if (std::getenv("ZMQ") || MUST_USE_ZMQ){
s = new ZMQPubSocket();
} else {
s = new MSGQPubSocket();
@ -82,7 +88,7 @@ PubSocket * PubSocket::create(Context * context, std::string endpoint){
Poller * Poller::create(){
Poller * p;
if (std::getenv("ZMQ")){
if (std::getenv("ZMQ") || MUST_USE_ZMQ){
p = new ZMQPoller();
} else {
p = new MSGQPoller();