M
Marek
Hi,
I am analyzing Duwamish7 source code boundled with Visual Studio .NET 2003.
Could anoybody explain why the Monitor.Enter and Monitor.Exit block is used
inside a static constructor? The code can be found in Project
SystemFramework within module ApplicationLog.cs. Here comes the sample.
namespace Duwamish7.SystemFramework {
(some code...)
public class ApplicationLog {
(some code..)
static ApplicationLog() {
Type myType = typeof(ApplicationLog);
try {
if (!Monitor.TryEnter(myType)) {
Monitor.Enter(myType);
return;
}
(some code..)
}
finally {
Monitor.Exit(myType);
}
} // static constructor
} // class ApplicationLog
(some code..)
} //namespace Duwamish7.SystemFramework
namespace Duwamish7.SystemFramework {
(...)
public class ApplicationLog {
Type myType = typeof(ApplicationLog);
try {
if (!Monitor.TryEnter(myType)) {
Monitor.Enter(myType);
return;
}
(...)
Thank you in advance.
Mark
I am analyzing Duwamish7 source code boundled with Visual Studio .NET 2003.
Could anoybody explain why the Monitor.Enter and Monitor.Exit block is used
inside a static constructor? The code can be found in Project
SystemFramework within module ApplicationLog.cs. Here comes the sample.
namespace Duwamish7.SystemFramework {
(some code...)
public class ApplicationLog {
(some code..)
static ApplicationLog() {
Type myType = typeof(ApplicationLog);
try {
if (!Monitor.TryEnter(myType)) {
Monitor.Enter(myType);
return;
}
(some code..)
}
finally {
Monitor.Exit(myType);
}
} // static constructor
} // class ApplicationLog
(some code..)
} //namespace Duwamish7.SystemFramework
namespace Duwamish7.SystemFramework {
(...)
public class ApplicationLog {
Type myType = typeof(ApplicationLog);
try {
if (!Monitor.TryEnter(myType)) {
Monitor.Enter(myType);
return;
}
(...)
Thank you in advance.
Mark