开发者

Qt atomic operations implementation

开发者 https://www.devze.com 2023-01-24 20:43 出处:网络
i\'ve been trying to find where and how the reference counting for Qt is implemented. The QBasicAtomicInt and QAtomicInt use the ref() and deref() functions which pro开发者_C百科vide an efficient refe

i've been trying to find where and how the reference counting for Qt is implemented. The QBasicAtomicInt and QAtomicInt use the ref() and deref() functions which pro开发者_C百科vide an efficient reference counting API. These functions atomically increment and decrement the value but where are these functions implemented in the library? I am trying to understand how exactly Qt implements atomic reference counting. Thank you.


Atomic operations cannot be achieved in plain C++ so they are implemented directly in assembly for each specific processor architecture.

Here is the source for Qt's atomic operations for x86 processors: http://qt.gitorious.org/qt/qt/blobs/4.7/src/corelib/arch/i386/qatomic_i386.s

0

精彩评论

暂无评论...
验证码 换一张
取 消