Re: [Vala] volatile variable

2014-06-17 Thread Jürg Billeter
On Tue, 2014-06-17 at 01:38 +0200, Maciej Piechotka wrote: On Mon, 2014-06-16 at 10:55 +0800, Nor Jaidi Tuah wrote: Summary: byte access (read/write) is atomic on MOST architectures. Dang! I thought ALL. I'm not sure but there is no guarantee that it is - you don't know it it will be,

Re: [Vala] volatile variable

2014-06-17 Thread Maciej Piechotka
On Tue, 2014-06-17 at 09:07 +0800, Nor Jaidi Tuah wrote: Thank you for all the feedback and discussion. I now realize that my app, which seems to work perfectly, is a time bomb that would blow my brain away because I'm using a pipeline where a finished job is indicated by setting a flag as

Re: [Vala] volatile variable

2014-06-17 Thread Maciej Piechotka
On Tue, 2014-06-17 at 08:20 +0200, Jürg Billeter wrote: On Tue, 2014-06-17 at 01:38 +0200, Maciej Piechotka wrote: On Mon, 2014-06-16 at 10:55 +0800, Nor Jaidi Tuah wrote: Summary: byte access (read/write) is atomic on MOST architectures. Dang! I thought ALL. I'm not sure but

Re: [Vala] volatile variable

2014-06-16 Thread Maciej Piechotka
On Mon, 2014-06-16 at 11:51 +0800, Nor Jaidi Tuah wrote: [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)

Re: [Vala] volatile variable

2014-06-16 Thread Maciej Piechotka
On Mon, 2014-06-16 at 10:55 +0800, Nor Jaidi Tuah wrote: Summary: byte access (read/write) is atomic on MOST architectures. Dang! I thought ALL. I'm not sure but there is no guarantee that it is - you don't know it it will be, say, in ARMv9. Alpha, while probably not in the top 3 most popular

Re: [Vala] volatile variable

2014-06-16 Thread Nor Jaidi Tuah
Thank you for all the feedback and discussion. I now realize that my app, which seems to work perfectly, is a time bomb that would blow my brain away because I'm using a pipeline where a finished job is indicated by setting a flag as the final instruction. Like this: . // do stuff

Re: [Vala] volatile variable

2014-06-15 Thread Edward Hennessy
On Jun 14, 2014, at 4:20 PM, Maciej Piechotka uzytkown...@gmail.com 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

Re: [Vala] volatile variable

2014-06-15 Thread Paul Marques Mota
2014-06-15 1:20 GMT+02:00 Maciej Piechotka uzytkown...@gmail.com: 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

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 Maciej Piechotka
On Sun, 2014-06-15 at 11:39 -0700, Edward Hennessy wrote: On Jun 14, 2014, at 4:20 PM, Maciej Piechotka uzytkownik2-re5jqeeqqe8avxtiumw...@public.gmane.org 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

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 uzytkownik2-re5jqeeqqe8avxtiumw...@public.gmane.org: 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

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).name());

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 not

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 volatile and

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. Turns

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 x86

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 ConcurrentList.

Re: [Vala] volatile variable

2014-06-14 Thread Maciej Piechotka
On Wed, 2014-06-11 at 16:54 +0800, Nor Jaidi Tuah wrote: Is there any way to declare a volatile? Gedit highlighting indicates that it is a keyword in vala. But trying volatile int xx; gives a compiler error. Nice day Nor Jaidi Tuah As a side question - why do you need volatile?

[Vala] volatile variable

2014-06-11 Thread Nor Jaidi Tuah
Is there any way to declare a volatile? Gedit highlighting indicates that it is a keyword in vala. But trying volatile int xx; gives a compiler error. Nice day Nor Jaidi Tuah PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you are neither the addressee

Re: [Vala] volatile variable

2014-06-11 Thread Michele Dionisio
you can try to create a vapi file with [SimpleType] [IntegerType] [CCode (cname = volatile_int_t, cheader_filename = volatile.h, has_type_id = false)] public struct volatile_int_t { } and a volatile.h with typedef volatile int volatile_int_t 2014-06-11 10:54 GMT+02:00 Nor Jaidi Tuah

Re: [Vala] volatile variable in vala

2009-12-30 Thread Abderrahim Kitouni
Hi, 2009/12/28 Nor Jaidi Tuah norjaidi.t...@ubd.edu.bn: Is volatile supported in Vala? I think it should. If so, what's the syntax? I guess volatile type identifier; but it seems not to be working now, someone needs to fix it. (if there is no bug about this bugzilla, please file one) HTH,

[Vala] volatile variable in vala

2009-12-29 Thread Nor Jaidi Tuah
Is volatile supported in Vala? If so, what's the syntax? If not, what's the alternative? hand Nor Jaidi Tuah ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list