Re: [Vala] volatile
- From: rastersoft <raster rastersoft com>
- To: vala-list gnome org
- Subject: Re: [Vala] volatile
- Date: Sat, 30 Jul 2011 01:45:01 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
El 28/07/11 10:25, Maciej Marcin Piechotka escribió:
Hi:
Remember that the marking variable as volatile in C does not make it
atomic. You still need something like:
volatile int i = 0;
// if (i)
if (GLib.AtomicInt.get(ref i) != 0)
..
// i = true;
GLib.AtomicInt.set(ref i, 1);
http://en.wikipedia.org/wiki/Volatile_variable#In_C_and_C.2B.2B
(I'm sorry if you do know that but either a) you do something
complicated and you need it b) you don't know that)
In my case I don't need the read or write to be atomic; anyway, thanks
for the note, I didn't know those functions.
- --
Nos leemos
RASTER (Linux user #228804)
raster rastersoft com http://www.rastersoft.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4zRf0ACgkQXEZvyfy1ha8vjgCeMjjJv6YCQortJa0vkGNeOlkC
HeYAoNVJ2X43fRu1UqRbg/H5TlRp+Zdz
=RyU6
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]