Re: static constructor and multithreading
From: Marek (marek.stachowicz_at_sbcglobal.net)
Date: 05/08/04
- Next message: Morten: "Re: Session variables with forms based authentication"
- Previous message: Joerg Jooss: "Re: Reading HTML Tables ?"
- In reply to: Jon Skeet [C# MVP]: "Re: static constructor and multithreading"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 08 May 2004 09:42:31 GMT
Thank you Jon. It's more than clear now.
Marek
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1b06887c2fbb3ce798a88f@msnews.microsoft.com...
> Marek <marek.stachowicz@sbcglobal.net> wrote:
> > I was not precise enough in the question 4. Of course, other resources
may
> > have to be protected against concurrent access. I meant that locking on
the
> > type class instance inside the static constructor does not make any
sense.
> > Is that correct?
>
> No - because as Nicholas said, other classes may be using the type for
> locking as well. The things that the static constructor does may need
> to execute separately from anything else which would lock on the type.
>
> > As far as I have understood your answer to the helper question, CLR
provides
> > some kind of protection against letting other static methods get started
> > before the static constructor ends its execution. Is that what you said?
>
> Yes, with some conditions. See section 9.5.3 of partition 1 of the ECMA
> spec for more details.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
- Next message: Morten: "Re: Session variables with forms based authentication"
- Previous message: Joerg Jooss: "Re: Reading HTML Tables ?"
- In reply to: Jon Skeet [C# MVP]: "Re: static constructor and multithreading"
- Messages sorted by: [ date ] [ thread ]