You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/05/09 15:34:46 UTC

[GitHub] [pulsar] merlimat commented on pull request #15508: [fix][c++ client] avoid race condition causing double callback on close

merlimat commented on PR #15508:
URL: https://github.com/apache/pulsar/pull/15508#issuecomment-1121258950

   The problem is that the decrement and checking of the counter are not done in atomic fashion:
   
   ```cpp
       if (*numberOfOpenHandlers > 0) {
           --(*numberOfOpenHandlers);
       }
       if (*numberOfOpenHandlers == 0) {
           // .....
       }
   ```
   
   We should instead convert into: 
   
   ```cpp
       if (--(*numberOfOpenHandlers) == 0) {
           // .....
       }
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org