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 the final instruction. Like this:
> 
>     .....
>     // do stuff
>     .....
>     // and finally
>     flag = flag_val;
>     // WRONG. Can be reordered even if
>     // atomicity can be assumed
> 
> I have to put a barrier to ensure that the flag
> setting is REALLY the final instruction. Can
> I do this?
> 
>     .....
>     // do stuff
>     .....
>     // and finally
>     AtomicInt.@set (ref flag, flag_val);
>     // Safe????
> 
> What's the correct way to do this in vala?
> 
> 
> Nice day
> Nor Jaidi Tuah
> 

It should be safe with respect to setting flag. The AtomicInt.@set will
not be reordered neither by the compiler nor by processor.

Best regards

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to