Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
> [1] Note that because the libgee deals with pointers it needs to > implement a bit more. If you need a guide see > http://blog.piechotka.com.pl/2014/03/01/lock-free-collection-in-libgee-hazard-pointer/ > (even more self-promotion) > Thanks for the link. That eventually leads me to ConcurrentLi

Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
Summary: byte access (read/write) is atomic on MOST architectures. Dang! I thought ALL. > [1] Synchronized means if x and y are set to 0 and thread 1 sets first x > and then y to 1 then thread 2 might read y == 1 and then x == 0. Atomic > means that state of x and y are either 0 or 1. Note that x8

Re: [Vala] volatile variable

2014-06-15 Thread Maciej Piechotka
On Mon, 2014-06-16 at 08:44 +0800, Nor Jaidi Tuah wrote: > > As a side question - why do you need volatile? In most cases it's not > > needed (unless you write kernel/driver and do memory based I/O). > > My multithreaded code didn't work and I thought > may be gcc is making a wrong optimization. >

Re: [Vala] volatile variable

2014-06-15 Thread Maciej Piechotka
On Mon, 2014-06-16 at 09:18 +0800, Nor Jaidi Tuah wrote: > > True - there is a few cases where volatile can be used (I know too > > little about security to say if using just volatile is ok from standard > > POV). I guess you could reformulate my question into - "in most you > > don't need volatil

Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
> True - there is a few cases where volatile can be used (I know too > little about security to say if using just volatile is ok from standard > POV). I guess you could reformulate my question into - "in most you > don't need volatile and many programmers use volatile as atomic despite > it does

Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
> /* Need to register types with the glib type system for dynamic > * construction with gtkbuilder. Need to figure out a better way > * to ensure the calls to typeof() are not optimized out. > */ > > stdout.printf("Registering %s\n", typeof(AboutDialog).n

Re: [Vala] volatile variable

2014-06-15 Thread Maciej Piechotka
On Mon, 2014-06-16 at 02:29 +0200, Paul Marques Mota wrote: > 2014-06-15 1:20 GMT+02:00 Maciej Piechotka > : > > > On Wed, 2014-06-11 at 16:54 +0800, Nor Jaidi Tuah wrote: > > > Is there any way to declare a volatile? > > > > As a side question - why do you need volatile? In most cases it's not >

Re: [Vala] volatile variable

2014-06-15 Thread Maciej Piechotka
On Sun, 2014-06-15 at 11:39 -0700, Edward Hennessy wrote: > On Jun 14, 2014, at 4:20 PM, Maciej Piechotka > wrote: > > > > As a side question - why do you need volatile? In most cases it's not > > needed (unless you write kernel/driver and do memory based I/O). > > > > I've run into the issue

Re: [Vala] volatile variable

2014-06-15 Thread Nor Jaidi Tuah
> As a side question - why do you need volatile? In most cases it's not > needed (unless you write kernel/driver and do memory based I/O). My multithreaded code didn't work and I thought may be gcc is making a wrong optimization. Turns out to be my own fault. But still, I'm curious, can gcc make

Re: [Vala] volatile variable

2014-06-15 Thread Paul Marques Mota
2014-06-15 1:20 GMT+02:00 Maciej Piechotka : > On Wed, 2014-06-11 at 16:54 +0800, Nor Jaidi Tuah wrote: > > Is there any way to declare a volatile? > > As a side question - why do you need volatile? In most cases it's not > needed (unless you write kernel/driver and do memory based I/O). > Or unl

Re: [Vala] volatile variable

2014-06-15 Thread Edward Hennessy
On Jun 14, 2014, at 4:20 PM, Maciej Piechotka wrote: > > As a side question - why do you need volatile? In most cases it's not > needed (unless you write kernel/driver and do memory based I/O). > I've run into the issue calling functions with side effects. Here is a snippet of my code with th