Re: [Vala] volatile variable




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 mean that. Are you sure that your use case is legitimate?".

I have one use case which may not be legitimate
academically (whatever that means), but in
practice should be ok. I assume that access to
a byte is always atomic and so I don't have to
use a lock or other sync mechanisms. I think
this is reasonable if my routine can tolerate
cache delay (one thread already updating, another
thread still using the old value). But I still need
to tell the compiler to suppress its optimization,
hence volatile.

I think my use case is valid unless 4-bit processors
are coming back. Or, unless cache delays are
indefinitely long.


Nice day
Nor Jaidi Tuah







PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you are neither the addressee 
(intended recipient) nor an authorised recipient of the addressee, and have received this message in error, 
please destroy this message (including attachments) and notify the sender immediately. STRICT PROHIBITION: 
This message, whether in part or in whole, should not be reviewed, retained, copied, reused, disclosed, 
distributed or used for any purpose whatsoever. Such unauthorised use may be unlawful and may contain 
material protected by the Official Secrets Act (Cap 153) of the Laws of Brunei Darussalam. DISCLAIMER: 
We/This Department/The Government of Brunei Darussalam, accept[s] no responsibility for loss or damage 
arising from the use of this message in any manner whatsoever. Our messages are checked for viruses but we do 
not accept liability for any viruses which may be transmitted in or with this message.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]