C++ Thread Safe Integer

前端 未结 6 629
醉话见心
醉话见心 2021-02-07 06:57

I have currently created a C++ class for a thread safe integer which simply stores an integer privately and has public get a set functions which use a boost::mutex to ensure tha

6条回答
  •  暖寄归人
    2021-02-07 07:23

    C++ has no real atomic integer implementation, neither do most common libraries.

    Consider the fact that even if said implementation would exist, it would have to rely on some sort of mutex - due to the fact that you cannot guarantee atomic operations across all architectures.

提交回复
热议问题