[Mono-list] Problem with Threading.Interlocked.Increment
Francisco Figueiredo Jr.
fxjrlists@yahoo.com.br
Thu, 23 Dec 2004 17:41:36 -0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I don't know if this was already reported, I searched bugzilla and found
nothing about it.
I'm having an strange problem with Interlocked.Increment:
With this class:
public class t
{
~ static Int32 i = 0;
~ public static void Main()
~ {
~ Console.WriteLine(System.Threading.Interlocked.Increment(ref i));
~ Console.WriteLine(System.Threading.Interlocked.Increment(ref i));
~ Console.WriteLine(System.Threading.Interlocked.Increment(ref i));
~ Console.WriteLine(System.Threading.Interlocked.Increment(ref i));
~ }
}
I get the following output:
0
2
4
6
I don't know what could be causing that.
I could see a lot of functions in atomic.h, but just see :)
ASM isn't really nice to me :)
Thanks in advance.
- --
Regards,
Francisco Figueiredo Jr.
Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member
http://monobrasil.softwarelivre.org
- -------------
"Science without religion is lame;
religion without science is blind."
~ ~ Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iQEVAwUBQcsfcP7iFmsNzeXfAQJF1gf+OyWKcG7Bp1AkBoEiUr+B8tXzRVA8+VEA
8aYW/7ar5LkH+caVJ/zvsOKO4thHy+a+fyCTi+E7Z30xYkA1/x81/ukJdzgh2tnc
uuSoGUk/sozy90wD5tc/+1eJntzyxIzdkcIKQqFlr+bNEyBdzwq0/uPpJSY8iZG1
zyn4qCE9w6dSxqU47Lyk9Ci3OLJuBUv8EeZG0sTS4F63xPeX3cLMfGGc20z86sLh
FxLZz6Aq/PQMqLMurtQEQj0HxA2iYoIASndLctvzqvo4zMAwoBXwe8xBs+gQv1/q
dhgEKe7T3uM5600c7RB0Zs8yTb+QlGYJ1xHhHNX3/FR0f/Dq5YShgg==
=njIE
-----END PGP SIGNATURE-----