On 3月8日, 下午8时44分, "Anthony Jones" <A...@yadayadayada.com> wrote:
> "lander" <lostlander....@gmail.com> wrote in message
>
> news:cbc61d9b-32b4-4a81-a7ab-(E-Mail Removed)...
>
> > That is, if multiple users are requesting or posting to the same page,
> > is the the code under app_code reentrant??? Why?
>
> I'm not sure you are using the term re-entrant appropriately I suspect you
> mean is it threadsafe. The answer is: its up to you.
>
> Normally classes that you may place in app_code that are then instanced by
> ASPX pages will be threadsafe in that they are only being used by one thread
> for the duration of the current request processing. However if you then
> place instances such classes somewhere that can be accessed by more than one
> thread (cache, static member etc) the responsibility for creating thread
> safety is yours.
>
> --
> Anthony Jones - MVP ASP/ASP.NET
Ok, i create one variable inside the page class, which is static and
its value is set in page_load, is it safe to do so?
|