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)



Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/2dca8050
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/2dca8050
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/2dca8050

Branch: refs/heads/origin/trunk
Commit: 2dca80504f208d4a9c1b42a66996c0eb21d42924
Parents: 15376d4
Author: Nicko Cadell <ni...@apache.org>
Authored: Fri Mar 4 21:11:48 2005 +0000
Committer: Nicko Cadell <ni...@apache.org>
Committed: Fri Mar 4 21:11:48 2005 +0000

----------------------------------------------------------------------
 src/DateFormatter/AbsoluteTimeDateFormatter.cs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/2dca8050/src/DateFormatter/AbsoluteTimeDateFormatter.cs
----------------------------------------------------------------------
diff --git a/src/DateFormatter/AbsoluteTimeDateFormatter.cs 
b/src/DateFormatter/AbsoluteTimeDateFormatter.cs
index 118fe1c..a026413 100755
--- a/src/DateFormatter/AbsoluteTimeDateFormatter.cs
+++ b/src/DateFormatter/AbsoluteTimeDateFormatter.cs
@@ -121,8 +121,16 @@ namespace log4net.DateFormatter
                                                // 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;
                                        }
                                }

Reply via email to