You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/08/21 15:40:36 UTC

[logging-log4cxx] branch LOGCXX-431 updated: Moved to helpers namespace and made test compile on windows

This is an automated email from the ASF dual-hosted git repository.

rmiddleton pushed a commit to branch LOGCXX-431
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/LOGCXX-431 by this push:
     new a41756b  Moved to helpers namespace and made test compile on windows
a41756b is described below

commit a41756b4847c80c9e159bea7402d2af857102d9b
Author: Robert Middleton <ro...@rm5248.com>
AuthorDate: Sat Aug 21 11:40:27 2021 -0400

    Moved to helpers namespace and made test compile on windows
---
 src/main/cpp/threadutility.cpp                   | 14 +++++++-------
 src/main/include/log4cxx/helpers/threadutility.h | 16 +++++++++-------
 src/test/cpp/helpers/threadutilitytestcase.cpp   |  4 ++--
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/main/cpp/threadutility.cpp b/src/main/cpp/threadutility.cpp
index 165803b..229d2d0 100644
--- a/src/main/cpp/threadutility.cpp
+++ b/src/main/cpp/threadutility.cpp
@@ -9,7 +9,7 @@
 #include <processthreadsapi.h>
 #endif
 
-using log4cxx::ThreadUtility;
+using log4cxx::helpers::ThreadUtility;
 
 struct ThreadUtility::priv_data{
 	priv_data(){
@@ -18,9 +18,9 @@ struct ThreadUtility::priv_data{
 		post_start = nullptr;
 	}
 
-	log4cxx::pre_thread_start pre_start;
-	log4cxx::thread_started thread_start;
-	log4cxx::post_thread_start post_start;
+	log4cxx::helpers::pre_thread_start pre_start;
+	log4cxx::helpers::thread_started thread_start;
+	log4cxx::helpers::post_thread_start post_start;
 };
 
 ThreadUtility::ThreadUtility() :
@@ -78,14 +78,14 @@ void ThreadUtility::postThreadUnblockSignals(){
 }
 
 
-log4cxx::pre_thread_start ThreadUtility::preStartFunction(){
+log4cxx::helpers::pre_thread_start ThreadUtility::preStartFunction(){
 	return m_priv->pre_start;
 }
 
-log4cxx::thread_started ThreadUtility::threadStartedFunction(){
+log4cxx::helpers::thread_started ThreadUtility::threadStartedFunction(){
 	return m_priv->thread_start;
 }
 
-log4cxx::post_thread_start ThreadUtility::postStartFunction(){
+log4cxx::helpers::post_thread_start ThreadUtility::postStartFunction(){
 	return m_priv->post_start;
 }
diff --git a/src/main/include/log4cxx/helpers/threadutility.h b/src/main/include/log4cxx/helpers/threadutility.h
index 246e284..94af5bd 100644
--- a/src/main/include/log4cxx/helpers/threadutility.h
+++ b/src/main/include/log4cxx/helpers/threadutility.h
@@ -8,6 +8,7 @@
 #include "log4cxx/logstring.h"
 
 namespace log4cxx {
+namespace helpers {
 
 /**
  * A function that will be called before a thread is started.  This can
@@ -42,9 +43,9 @@ class LOG4CXX_EXPORT ThreadUtility {
 private:
 	ThreadUtility();
 
-	log4cxx::pre_thread_start preStartFunction();
-	log4cxx::thread_started threadStartedFunction();
-	log4cxx::post_thread_start postStartFunction();
+	log4cxx::helpers::pre_thread_start preStartFunction();
+	log4cxx::helpers::thread_started threadStartedFunction();
+	log4cxx::helpers::post_thread_start postStartFunction();
 
 	struct priv_data;
 	std::unique_ptr<priv_data> m_priv;
@@ -92,9 +93,9 @@ public:
 	std::thread createThread(LogString name,
 							 Function&& f,
 							 Args&&... args){
-		log4cxx::pre_thread_start pre_start = preStartFunction();
-		log4cxx::thread_started thread_start = threadStartedFunction();
-		log4cxx::post_thread_start post_start = postStartFunction();
+		log4cxx::helpers::pre_thread_start pre_start = preStartFunction();
+		log4cxx::helpers::thread_started thread_start = threadStartedFunction();
+		log4cxx::helpers::post_thread_start post_start = postStartFunction();
 
 		if( pre_start ){
 			pre_start();
@@ -112,6 +113,7 @@ public:
 	}
 };
 
-}
+} /* namespace helpers */
+} /* namespace log4cxx */
 
 #endif
diff --git a/src/test/cpp/helpers/threadutilitytestcase.cpp b/src/test/cpp/helpers/threadutilitytestcase.cpp
index 1aacb62..7c7ec36 100644
--- a/src/test/cpp/helpers/threadutilitytestcase.cpp
+++ b/src/test/cpp/helpers/threadutilitytestcase.cpp
@@ -35,7 +35,7 @@ public:
 
 		thrUtil->configureThreadFunctions( nullptr, nullptr, nullptr );
 
-		std::thread t = thrUtil->createThread( "FooName", [](){} );
+		std::thread t = thrUtil->createThread( LOG4CXX_STR("FooName"), [](){} );
 
 		t.join();
 	}
@@ -58,7 +58,7 @@ public:
 			num_post++;
 		});
 
-		std::thread t = thrUtil->createThread( "FooName", [](){} );
+		std::thread t = thrUtil->createThread( LOG4CXX_STR("FooName"), [](){} );
 
 		t.join();