You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by dp...@apache.org on 2017/04/27 06:36:07 UTC
[03/50] [abbrv] logging-log4net git commit: LOG4NET-536 there doesn't
seem to be a system wide Mutex in NETCF
LOG4NET-536 there doesn't seem to be a system wide Mutex in NETCF
Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/d65b1a76
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/d65b1a76
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/d65b1a76
Branch: refs/heads/master
Commit: d65b1a76bc7aeb92b2c836f554148686d1460bad
Parents: 9f69a10
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Nov 30 05:15:43 2016 +0000
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Nov 30 05:15:43 2016 +0000
----------------------------------------------------------------------
src/Appender/RollingFileAppender.cs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/d65b1a76/src/Appender/RollingFileAppender.cs
----------------------------------------------------------------------
diff --git a/src/Appender/RollingFileAppender.cs b/src/Appender/RollingFileAppender.cs
index ac59ec4..63ffaeb 100644
--- a/src/Appender/RollingFileAppender.cs
+++ b/src/Appender/RollingFileAppender.cs
@@ -241,11 +241,17 @@ namespace log4net.Appender
/// </summary>
~RollingFileAppender()
{
+#if !NETCF
if (m_mutexForRolling != null)
{
+#if NET_4_0 || MONO_4_0 || NETSTANDARD1_3
+ m_mutexForRolling.Dispose();
+#else
m_mutexForRolling.Close();
+#endif
m_mutexForRolling = null;
}
+#endif
}
#endregion Public Instance Constructors
@@ -606,6 +612,7 @@ namespace log4net.Appender
virtual protected void AdjustFileBeforeAppend()
{
// reuse the file appenders locking model to lock the rolling
+#if !NETCF
try
{
// if rolling should be locked, acquire the lock
@@ -613,6 +620,7 @@ namespace log4net.Appender
{
m_mutexForRolling.WaitOne();
}
+#endif
if (m_rollDate)
{
DateTime n = m_dateTime.Now;
@@ -632,6 +640,7 @@ namespace log4net.Appender
RollOverSize();
}
}
+#if !NETCF
}
finally
{
@@ -641,6 +650,7 @@ namespace log4net.Appender
m_mutexForRolling.ReleaseMutex();
}
}
+#endif
}
/// <summary>
@@ -1148,8 +1158,10 @@ namespace log4net.Appender
m_baseFileName = base.File;
}
+#if !NETCF
// initialize the mutex that is used to lock rolling
m_mutexForRolling = new Mutex(false, m_baseFileName.Replace("\\", "_").Replace(":", "_").Replace("/", "_"));
+#endif
if (m_rollDate && File != null && m_scheduledFilename == null)
{
@@ -1677,11 +1689,13 @@ namespace log4net.Appender
/// </summary>
private string m_baseFileName;
+#if !NETCF
/// <summary>
/// A mutex that is used to lock rolling of files.
/// </summary>
private Mutex m_mutexForRolling;
-
+#endif
+
#endregion Private Instance Fields
#region Static Members