I have a interest in design patterns. Would be posting several useful links on design patterns . Starting off with the simplest design pattern.
http://msdn2.microsoft.com/en-us/library/ms998426.aspx is a MSDN link on the Singleton Design pattern. This is a very simple design pattern.
This article has an implementation with C#.It uses the lock keyword for mutual exclusion.
What is lock?
The lock keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. This statement takes the following form:
Object thisLock = new Object();
lock (thisLock)
{
// Critical code section
}
==============================================================
http://en.wikipedia.org/wiki/Singleton_pattern is the wikipedia link on the Singleton design pattern.
No comments:
Post a Comment