You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2005/03/04 22:11:49 UTC
cvs commit: logging-log4net/src/DateFormatter AbsoluteTimeDateFormatter.cs
nicko 2005/03/04 13:11:49
Modified: src/DateFormatter AbsoluteTimeDateFormatter.cs
Log:
Added Thread.MemoryBarrier call on NET_1_1 after writing to local variable, this is only required on SMP machines with a weak memory model (e.g. Itanium)
Revision Changes Path
1.9 +9 -1 logging-log4net/src/DateFormatter/AbsoluteTimeDateFormatter.cs
Index: AbsoluteTimeDateFormatter.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/DateFormatter/AbsoluteTimeDateFormatter.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbsoluteTimeDateFormatter.cs 7 Feb 2005 22:41:16 -0000 1.8
+++ AbsoluteTimeDateFormatter.cs 4 Mar 2005 21:11:48 -0000 1.9
@@ -121,8 +121,16 @@
// Calculate the new string for this second
FormatDateWithoutMillis(dateToFormat, s_lastTimeBuf);
+ // Render the string buffer to a string
+ string currentDateWithoutMillis = s_lastTimeBuf.ToString();
+
+#if NET_1_1
+ // Ensure that the above string is written into the variable NOW on all threads.
+ // This is only required on multiprocessor machines with weak memeory models
+ System.Threading.Thread.MemoryBarrier();
+#endif
// Store the time as a string (we only have to do this once per second)
- s_lastTimeString = s_lastTimeBuf.ToString();
+ s_lastTimeString = currentDateWithoutMillis;
s_lastTimeToTheSecond = currentTimeToTheSecond;
}
}