Hi Simon,
If the control sits on a Web Page it's probably safe, unless you have
static/shared members in the control.
Remember that a control is an object that gets instantiated by the HTTP
Runtime on a particular thread. One thread / one Page typically (unless you
run async requests or fire your own threads). Another thread can't easily
call into this page and any control on the page by default is private
anyway, so unless you're doing somehting tricky with state (sessions,
Application object, or caching your data in a static member somewhere) in
your application you won't have any problems.
You do need to watch out for static/shared members in components or
controls. Those can easily cause problems if not properly managed...
+++ Rick ---
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/ http://www.west-wind.com/weblog/ http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Hi all.
I have a page and a control that both raise the same issue:
I have the following code:
private bool isInCreateMode = false;
public bool IsInCreateMode{
get{
...
}
set{
...
}
}
My question is, given that this variable is global ie, outside the context
of a given method call, is it thread safe?
I know that in java, declaring a variable globaly like that can cause
problems.
Do I need to worry?
Thanks
Simon