Are instance variables also shared just like static variables? Does this mean that race conditions happen due to static and instance variables only?
Are instance variables also shared just like static variables? Does this mean that race
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes instance variables are shared as well, if multiple threads have access to the instance then there may be a need to protect against stale reads or multi-part writes that can corrupt the object’s state.
Additionally, accessing external resources such as files on the file system can cause race conditions.