#include <kis_shared.h>
Definition at line 13 of file kis_shared.h.
◆ KisShared() [1/2]
◆ KisShared() [2/2]
NOTE: The description of how Weak shared pointers system works:
Every KisShared object has his own _sharedWeakReference pointer. This pointer holds QAtomicInt counter. When KisShared constructs itself, it increments _sharedWeakReference by one. When it dies - it decrements it. This is the only way how the number in the counter can become odd. Obviously, when the number falls to zero, the counter object is deleted.
When a weak shared pointer is created, it gets the pointer and increments the counter by 2, so the parity of the number is kept unchanged. Now the counter is shared between the KisShared and KisWeakSharedPtr and the latter one can check the correctness of the pointer by checking parity!
We can defer creation of a weak reference until better days... It gives us 41% better performance. ;)
Definition at line 28 of file kis_shared.cpp.
29{
35}
QAtomicInt * _sharedWeakReference
References _sharedWeakReference.
◆ ~KisShared()
| KisShared::~KisShared |
( |
| ) |
|
|
protected |
◆ deref()
| bool KisShared::deref |
( |
| ) |
|
|
inline |
◆ operator=()
◆ ref()
◆ refCount()
| int KisShared::refCount |
( |
| ) |
|
|
inline |
◆ sharedWeakReference()
| QAtomicInt * KisShared::sharedWeakReference |
( |
| ) |
|
|
inline |
◆ _ref
| QAtomicInt KisShared::_ref |
|
private |
◆ _sharedWeakReference
| QAtomicInt* KisShared::_sharedWeakReference |
|
private |
The documentation for this class was generated from the following files: