Skip to content

Commit

Permalink
Use ZMQ on MacOS (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiubit committed May 20, 2020
1 parent 01cdf83 commit 67fae6a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions messaging/messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 67fae6a

Please sign in to comment.