You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2018/11/28 09:55:39 UTC

[GitHub] vongosling closed pull request #16: Fix compile errors on macOS

vongosling closed pull request #16: Fix compile errors on macOS
URL: https://github.com/apache/rocketmq-client-cpp/pull/16
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.gitignore b/.gitignore
index 00b4d47d..d414bcca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
 .idea
 cmake-build-debug/
+
+tmp_*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 161085a3..cb747f26 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,7 +159,9 @@ set(deplibs)
 # need to do a more detailed check and also include some extra deplibs.
 list(APPEND deplibs dl)
 list(APPEND deplibs pthread)
-list(APPEND deplibs rt)
+if(NOT APPLE)
+  list(APPEND deplibs rt)
+endif()
 list(APPEND deplibs z)
 
 # add include dir for bsd (posix uses /usr/include/)
diff --git a/src/consumer/ConsumeMessageConcurrentlyService.cpp b/src/consumer/ConsumeMessageConcurrentlyService.cpp
index 9df243ca..9d4e1a4c 100755
--- a/src/consumer/ConsumeMessageConcurrentlyService.cpp
+++ b/src/consumer/ConsumeMessageConcurrentlyService.cpp
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <sys/prctl.h>
 #endif
 #include "ConsumeMsgService.h"
@@ -29,7 +29,7 @@ ConsumeMessageConcurrentlyService::ConsumeMessageConcurrentlyService(
     : m_pConsumer(consumer),
       m_pMessageListener(msgListener),
       m_ioServiceWork(m_ioService) {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   string taskName = UtilAll::getProcessName();
   prctl(PR_SET_NAME, "ConsumeTP", 0, 0, 0);
 #endif
@@ -37,7 +37,7 @@ ConsumeMessageConcurrentlyService::ConsumeMessageConcurrentlyService(
     m_threadpool.create_thread(
         boost::bind(&boost::asio::io_service::run, &m_ioService));
   }
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   prctl(PR_SET_NAME, taskName.c_str(), 0, 0, 0);
 #endif
 }
diff --git a/src/consumer/ConsumeMessageOrderlyService.cpp b/src/consumer/ConsumeMessageOrderlyService.cpp
index 04efa7db..e66c0cbf 100755
--- a/src/consumer/ConsumeMessageOrderlyService.cpp
+++ b/src/consumer/ConsumeMessageOrderlyService.cpp
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <sys/prctl.h>
 #endif
 #include "ConsumeMsgService.h"
@@ -34,7 +34,7 @@ ConsumeMessageOrderlyService::ConsumeMessageOrderlyService(
       m_MaxTimeConsumeContinuously(60 * 1000),
       m_ioServiceWork(m_ioService),
       m_async_service_thread(NULL) {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   string taskName = UtilAll::getProcessName();
   prctl(PR_SET_NAME, "oderlyConsumeTP", 0, 0, 0);
 #endif
@@ -42,7 +42,7 @@ ConsumeMessageOrderlyService::ConsumeMessageOrderlyService(
     m_threadpool.create_thread(
         boost::bind(&boost::asio::io_service::run, &m_ioService));
   }
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   prctl(PR_SET_NAME, taskName.c_str(), 0, 0, 0);
 #endif
 }
diff --git a/src/thread/task_queue.cpp b/src/thread/task_queue.cpp
index ef2fb37a..e7c062e8 100755
--- a/src/thread/task_queue.cpp
+++ b/src/thread/task_queue.cpp
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 #include "task_queue.h"
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <sys/prctl.h>
 #endif
 #include "UtilAll.h"
@@ -29,7 +29,7 @@ Task* taskEventFactory::NewInstance(const int& size) const {
 
 taskBatchHandler::taskBatchHandler(int pullMsgThreadPoolNum)
     : m_ioServiceWork(m_ioService) {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   string taskName = UtilAll::getProcessName();
   prctl(PR_SET_NAME, "PullMsgTP", 0, 0, 0);
 #endif
@@ -37,7 +37,7 @@ taskBatchHandler::taskBatchHandler(int pullMsgThreadPoolNum)
     m_threadpool.create_thread(
         boost::bind(&boost::asio::io_service::run, &m_ioService));
   }
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   prctl(PR_SET_NAME, taskName.c_str(), 0, 0, 0);
 #endif
 }
diff --git a/src/transport/TcpRemotingClient.cpp b/src/transport/TcpRemotingClient.cpp
index 821a7279..5cd70eb4 100755
--- a/src/transport/TcpRemotingClient.cpp
+++ b/src/transport/TcpRemotingClient.cpp
@@ -16,7 +16,7 @@
  */
 #include "TcpRemotingClient.h"
 #include <stddef.h>
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 #include <sys/prctl.h>
 #endif
 #include "Logging.h"
@@ -35,7 +35,7 @@ TcpRemotingClient::TcpRemotingClient(int pullThreadNum,
       m_tcpTransportTryLockTimeout(tcpTransportTryLockTimeout),
       m_namesrvIndex(0),
       m_ioServiceWork(m_ioService) {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)  
   string taskName = UtilAll::getProcessName();
   prctl(PR_SET_NAME, "networkTP", 0, 0, 0);
 #endif
@@ -43,7 +43,7 @@ TcpRemotingClient::TcpRemotingClient(int pullThreadNum,
     m_threadpool.create_thread(
         boost::bind(&boost::asio::io_service::run, &m_ioService));
   }
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
   prctl(PR_SET_NAME, taskName.c_str(), 0, 0, 0);
 #endif
   LOG_INFO(


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services