Return whether the reference count is one. If the reference count is used in the conventional way, a refrerence count of 1 implies that the current thread owns the reference and no other thread shares it. This call performs the test for a reference count of one, and performs the memory barrier needed for the owning thread to act on the object, knowing that it has exclusive access to the object.
| 57 | // needed for the owning thread to act on the object, knowing that it has |
| 58 | // exclusive access to the object. |
| 59 | inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) { |
| 60 | bool res = (subtle::Acquire_Load(ptr) == 1); |
| 61 | if (res) { |
| 62 | ANNOTATE_HAPPENS_AFTER(ptr); |
| 63 | } |
| 64 | return res; |
| 65 | } |
| 66 | |
| 67 | // Return whether the reference count is zero. With conventional object |
| 68 | // referencing counting, the object will be destroyed, so the reference count |
no test coverage detected