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.



No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: