New Message on dotNET User Group Hyd

Article -- "Volatile" C# Keyword

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: Nasha

Hi All,
 
C# has a keyword named  "volatile".  This keyword is used to mark a particular object "volatile" . i.e. the value of this object can change any time in the program by any other thread or process and thus the system always reads the current value of such an object as the value of this object will never be cached.

This modifier is generally used if there are multiple threads using the same object without using the "lock" keyword. Using the volatile modifier ensures that all threads retrieve the latest value of the object.

Using volatile key word does not solve the thread synchronization problem.

Objects which can be marked volatile can be :

  • Any reference type.
  • Any pointer type (in an unsafe context).
  • Datatypes like sbyte, byte, short, ushort, int, uint, char, float, bool.
  • An enum type with an enum base type of byte, sbyte, short, ushort, int, or uint.
 
-- Please post your queries and comments for my articles in the usergroup for the benefit of all. I hope this step from my end is helpful to all of us.

Regards,

Namratha (Nasha).


View other groups in this category.

baazee.com

Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to