|
-
January 7th, 2010, 03:00 PM
#13
Re: Assigning value to a volatile string
The example code is incorrect because two are more threads can read or modify 'flag_' without using "functions that synchronize thread execution". The rule is still broken even after marking 'flag_' as volatile. As far as Posix is concerned, it's incorrect either way.
volatile is never needed when using the synchronization primitives provided by your threading library.
gg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|