rm5248 commented on code in PR #190:
URL: https://github.com/apache/logging-log4cxx/pull/190#discussion_r1096697212


##########
src/main/include/log4cxx/private/mutex.h:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LOG4CXX_PRIV_MUTEX_HDR_
+#define LOG4CXX_PRIV_MUTEX_HDR_
+#include <mutex>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/helpers/stringhelper.h>
+#if !defined(LOG4CXX)
+       #define LOG4CXX 1
+#endif
+#include <log4cxx/private/log4cxx_private.h>
+
+namespace log4cxx
+{
+
+using AppenderMutexType = std::mutex;
+using AppenderScopeGuard = std::lock_guard<AppenderMutexType>;
+using AppenderScopedLock = std::unique_lock<AppenderMutexType>;
+
+// Change mutex attributes to avoid priority inversion problems
+template <class M>
+       void
+EnablePriorityInheritance(M& m, helpers::Pool& p)

Review Comment:
   My understanding of this is as follows:
   1. you have multiple threads logging to the same appender that have 
different priorities
   2. that appender is NOT an `AsyncAppender`, so there is a priority inversion 
when a low-priority thread has IO control
   
   If that is correct, I now understand better what this is doing.
   
   Is there a reason that `AsyncAppender` is not appropriate in your situation? 
 It seems like that would be an easier way to solve the problem, since all of 
the IO then happens in a different thread.  



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