Can volatile keyword guarantee thread safe access to the variable

If you declared an variable as volatile, can you access the variable concurrently from multiple threads without using a lock? If you thought yes, read this article and think again.

And also there is a good article about why busy wait is bad, and Sleep(0) wouldn’t help.

Advertisements

Posted on June 6, 2012, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: