rm5248 commented on a change in pull request #68:
URL: https://github.com/apache/logging-log4cxx/pull/68#discussion_r697068021



##########
File path: src/main/cpp/threadutility.cpp
##########
@@ -0,0 +1,91 @@
+#include "log4cxx/helpers/threadutility.h"
+#include "log4cxx/private/log4cxx_private.h"
+#include "log4cxx/helpers/loglog.h"
+
+#include <signal.h>
+
+#if LOG4CXX_HAS_SETTHREADDESCRIPTION
+#include <windows.h>
+#include <processthreadsapi.h>
+#endif
+
+using log4cxx::helpers::ThreadUtility;
+
+struct ThreadUtility::priv_data{
+       priv_data(){
+               pre_start = nullptr;
+               thread_start = nullptr;
+               post_start = nullptr;
+       }
+
+       log4cxx::helpers::pre_thread_start pre_start;
+       log4cxx::helpers::thread_started thread_start;
+       log4cxx::helpers::post_thread_start post_start;
+};
+
+ThreadUtility::ThreadUtility() :
+       m_priv( new priv_data() )
+{}
+
+ThreadUtility::~ThreadUtility(){}
+
+std::shared_ptr<ThreadUtility> ThreadUtility::instance(){
+       static std::shared_ptr<ThreadUtility> instance( new ThreadUtility() );
+       return instance;
+}
+
+void ThreadUtility::configureThreadFunctions( pre_thread_start pre_start1,
+                                                          thread_started 
started,
+                                                          post_thread_start 
post_start1 ){
+       m_priv->pre_start = pre_start1;
+       m_priv->thread_start = started;
+       m_priv->post_start = post_start1;
+}
+
+void ThreadUtility::preThreadBlockSignals(){
+#if LOG4CXX_HAS_PTHREAD_SIGMASK
+       sigset_t set;
+       sigfillset(&set);
+       if( pthread_sigmask(SIG_SETMASK, &set, nullptr) < 0 ){
+               LOGLOG_ERROR( LOG4CXX_STR("Unable to set thread sigmask") );
+       }
+#endif /* LOG4CXX_HAS_PTHREAD_SIGMASK */
+}
+
+void ThreadUtility::threadStartedNameThread(LogString threadName,
+                                                        std::thread::id 
/*thread_id*/,
+                                                        
std::thread::native_handle_type native_handle){

Review comment:
       Looking at it again, I also realized that I had done cpp_style instead 
of JavaStyle for the function definitions as well.  Since the rest of the 
library is all JavaStyle, I've made those updates as well.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to