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/13 06:37:18 UTC

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

ams-tschoening commented on code in PR #130:
URL: https://github.com/apache/logging-log4cxx/pull/130#discussion_r969206179


##########
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:
   Not sure I'm able to follow this discussion: What's the overall reason of introducing the BORLANDC-specific code at all? What are you actually trying to target, the IDE or the 32 Bit legacy compiler or the newer CLANG one or ...? The legacy 32 Bit compiler doesn't even fully support C++11, so I pretty much doubt that the available code works at all. What do you think using `#if !BORLANDC` tell you? :-)



-- 
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