home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,557 of 33,346   
   Marc to Agents Marlow   
   Re: atomic counter   
   11 Oct 11 20:19:38   
   
   4ae6c1c0   
   From: marc.glisse@gmail.com   
      
   Agents Marlow  wrote:   
      
   > On Oct 9, 1:27 pm, Marc  wrote:   
   >> Hello,   
   >>   
   >> I am trying to make our reference counting implementation thread-safe   
   >> (for a very basic definition of thread-safe), which essentially means   
   >> making the counter atomic.   
   >   
   > I would take a look at the implementation of the atomic counter in the   
   > Poco Foundation class library.   
      
   Thanks for the pointer.   
   They only implement it lock-free for windows and mac, and the   
   interesting part is that on mac they use the atomic operations without   
   a memory barrier (and since mac used to run on PPC, it makes a   
   difference).  They perform a load by simply reading the variable (an   
   int) which doesn't offer any protection against compiler   
   optimizations, I am trying to think of the worst that could happen   
   because of that...   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca