|
Krita Source Code Documentation
|
#include <kis_lockless_stack.h>
Classes | |
| struct | Node |
Public Member Functions | |
| void | clear () |
| bool | isEmpty () const |
| KisLocklessStack () | |
| void | mergeFrom (KisLocklessStack< T > &other) |
| bool | pop (T &value) |
| void | push (T data) |
| qint32 | size () const |
| ~KisLocklessStack () | |
Private Member Functions | |
| void | cleanUpNodes () |
| void | freeList (Node *first) |
| void | releaseNode (Node *node) |
Private Attributes | |
| QAtomicInt | m_deleteBlockers |
| QAtomicPointer< Node > | m_freeNodes |
| QAtomicInt | m_numNodes |
| QAtomicPointer< Node > | m_top |
Definition at line 23 of file kis_lockless_stack.h.
|
inline |
Definition at line 32 of file kis_lockless_stack.h.
|
inline |
Definition at line 33 of file kis_lockless_stack.h.
References KisLocklessStack< T >::freeList(), KisLocklessStack< T >::m_freeNodes, and KisLocklessStack< T >::m_top.
|
inlineprivate |
If we are the only users of the objects is cleanChain, then just free it. Otherwise, push them back into the recycling list and keep them there till another chance comes.
Definition at line 177 of file kis_lockless_stack.h.
References KisLocklessStack< T >::freeList(), KisLocklessStack< T >::m_deleteBlockers, KisLocklessStack< T >::m_freeNodes, and KisLocklessStack< T >::Node::next.
|
inline |
We are the only owner of top contents. So we can delete it freely.
Definition at line 94 of file kis_lockless_stack.h.
References KisLocklessStack< T >::cleanUpNodes(), KisLocklessStack< T >::freeList(), KisLocklessStack< T >::m_deleteBlockers, KisLocklessStack< T >::m_numNodes, KisLocklessStack< T >::m_top, KisLocklessStack< T >::Node::next, and KisLocklessStack< T >::releaseNode().
|
inlineprivate |
Definition at line 202 of file kis_lockless_stack.h.
References KisLocklessStack< T >::Node::next.
|
inline |
Definition at line 163 of file kis_lockless_stack.h.
References KisLocklessStack< T >::m_numNodes.
|
inline |
Definition at line 132 of file kis_lockless_stack.h.
References KisLocklessStack< T >::m_numNodes, KisLocklessStack< T >::m_top, and KisLocklessStack< T >::Node::next.
|
inline |
Test if we are the only delete blocker left (it means that we are the only owner of 'top') If there is someone else in "delete-blocked section", then just add the struct to the list of free nodes.
Definition at line 53 of file kis_lockless_stack.h.
References KisLocklessStack< T >::cleanUpNodes(), KisLocklessStack< T >::Node::data, KisLocklessStack< T >::m_deleteBlockers, KisLocklessStack< T >::m_numNodes, KisLocklessStack< T >::m_top, KisLocklessStack< T >::Node::next, KisLocklessStack< T >::releaseNode(), and value().
|
inline |
Definition at line 39 of file kis_lockless_stack.h.
References KisLocklessStack< T >::Node::data, KisLocklessStack< T >::m_numNodes, KisLocklessStack< T >::m_top, and KisLocklessStack< T >::Node::next.
|
inlineprivate |
Definition at line 169 of file kis_lockless_stack.h.
References KisLocklessStack< T >::m_freeNodes, and KisLocklessStack< T >::Node::next.
|
inline |
This is impossible to measure the size of the stack in highly concurrent environment. So we return approximate value! Do not rely on this value much!
Definition at line 159 of file kis_lockless_stack.h.
References KisLocklessStack< T >::m_numNodes.
|
private |
Definition at line 218 of file kis_lockless_stack.h.
|
private |
Definition at line 216 of file kis_lockless_stack.h.
|
private |
Definition at line 219 of file kis_lockless_stack.h.
|
private |
Definition at line 215 of file kis_lockless_stack.h.