You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2022/09/12 23:16:23 UTC

[GitHub] [logging-log4cxx] swebb2066 commented on a diff in pull request #130: Reduce logging overhead by holding references

swebb2066 commented on code in PR #130:
URL: https://github.com/apache/logging-log4cxx/pull/130#discussion_r969007525


##########
src/main/cpp/loggingevent.cpp:
##########
@@ -297,40 +302,62 @@ LoggingEvent::KeySet LoggingEvent::getPropertyKeySet() const
 }
 
 
-const LogString LoggingEvent::getCurrentThreadName()
+const LogString& LoggingEvent::getCurrentThreadName()
 {
-#if APR_HAS_THREADS
-	LOG4CXX_THREAD_LOCAL LogString thread_name;
+#if defined(_WIN32)
+	using ThreadIdType = DWORD;
+	ThreadIdType threadId = GetCurrentThreadId();
+#elif APR_HAS_THREADS
+	using ThreadIdType = apr_os_thread_t;
+	ThreadIdType threadId = apr_os_thread_current();
+#else
+	using ThreadIdType = int;
+	ThreadIdType threadId = 0;
+#endif
 
-	if ( thread_name.size() )
+#if defined(__BORLANDC__)

Review Comment:
   I do not have a Borland compiler. My testing approach is to change the "#if __BORLANDC__" to "#if !__BORLANDC__", build and run tests 



-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org