[Mono-list] System.Collections.Stack

Garrett Rooney rooneg@electricjellyfish.net
Mon, 16 Jul 2001 16:37:42 -0400


On Tue, Jul 17, 2001 at 05:51:57AM +1000, Fergus Henderson wrote:
> On 16-Jul-2001, David Menestrina <dmenest@yahoo.com> wrote:
> >   Locking here is unnecessary because reading from
> >   an int should be atomic. (It is in Java...)
> 
> Same is true for the CLR, according to the ECMA specs
> (11.6 in Partition I).

How about get and set functions that just access a variable?

like this:

public Foo {
	get {
		return foo;
	}
}

would the thread safe version need to be like this?

public Foo {
	get {
		lock (whatever) {
			return whatever.Foo;
		}
	}
}

or is the lock unnecessary?

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.