tag:blogger.com,1999:blog-8231772264325864647.post7047360174926234563..comments2024-03-22T19:05:00.088+01:00Comments on Concurrency Freaks: Concurrency Pattern: Object Update (part 2)Pedro Ramalhetehttp://www.blogger.com/profile/01340437958052998917noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8231772264325864647.post-28931669754902778842014-02-06T21:54:58.378+01:002014-02-06T21:54:58.378+01:00Hi Vic,
Yes, that is correct, and a good point ind...Hi Vic,<br />Yes, that is correct, and a good point indeed.<br />The resetMembers() function you describe is wait-free, and I believe it maintains sequential consistency with incrementMembers() and sumMembers().<br />Pedro Ramalhetehttps://www.blogger.com/profile/01340437958052998917noreply@blogger.comtag:blogger.com,1999:blog-8231772264325864647.post-31229963898434838402014-02-06T19:09:29.043+01:002014-02-06T19:09:29.043+01:00Hi Pedro,
Am I correct in understanding that if I...Hi Pedro,<br /><br />Am I correct in understanding that if I needed a resetMembers( int x, int y, int z ) method, I could simply do this:<br /><br />public void resetMembers( int x, int y, int z ){<br /> innerRef.set( new InnerMyClass( x, y, z ) );<br />}<br /><br />Reason being, I don't need a loop and compareAndSet(...) as my new values are not dependant upon the older values.<br /><br />Cheers,<br />Vic<br />Anonymousnoreply@blogger.com