Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Volatile

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Volatile is used for a variable which can be modified asynchronously. How can modify a variable asynchronously?
Please help
Harish
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This modifier is used to identify a variable which can be modifed by different threads. So 'volatile' is suppose to tell the compiler to not perform certain optimizations on the variable.
So for example: you make two instances of ThreadClassA. In ThreadClassA there is a variable named 'VolatileTemp'. Each instance of TheadClassA can than change 'VolatileTemp' at will.
Did that answer your question in anyway?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic