Short answer, no. Your web farm will not sync on sections of code. Using
lock() will work within critical sections of code to assure that
simultaneous page requests (aspnet threads) do not access that block at the
same time.
Charlie Nilsson [msft]
Visual Studio Update
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
Content-Class: urn:content-classes:message
From: "szabelin" <szabelin@szabelin>
Sender: "szabelin" <szabelin@szabelin>
Subject: locking question
Date: Thu, 28 Aug 2003 16:51:19 -0700
Lines: 15
Message-ID: <06****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcNtv0cooriT4qAHSfqFUWE6k+sD6A==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.framework.aspnet
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:172521
NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Do all asp threads servicing requests run as part of same
app domain? I need a lock at the scope of my web-app; is
the code below a correct way to syncronize blocks of code
in asp.net. Will this work if load balancer (multiple
servers) are used? Thanks!
lock(typeof(string))
{}
or
lock(Singleton.Instance)
{}