Synchronization Locks
we can use Synchronization locks in Threading.
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
///
/// Summary description for Synchronization
///
public class Synchronization
{
int m_length;
public int Length
{
get { return m_length; }
set { m_length = value; }
}
public void IncrementLength()
{
Interlocked.Increment(ref m_length);
}
}
Interlocked is in the namespace System.Threading.This is useful for sharing variables in multiple threads.
:-)