|
Krita Source Code Documentation
|
#include <kis_safe_read_list.h>
Inheritance diagram for KisSafeReadList< T >:Public Member Functions | |
| const T & | at (int i) const |
| const T & | first () const |
| KisSafeReadList () | |
| const T & | last () const |
This is a special wrapper around QList class Q: Why is it needed? A: It guarantees thread-safety of all the read requests to the list. There is absolutely no guarantees for write requests though. Q: Why pure QList cannot guarantee it? A: First, Qt does not guarantee thread-safety for QList at all. Second, QList is implicitly shared structure, therefore even with read, but non-const requests (e.g. non-const QList::first()), QList will perform internal write operations. That will lead to a race condition in an environment with 3 and more threads.
Definition at line 27 of file kis_safe_read_list.h.
|
inline |
Definition at line 29 of file kis_safe_read_list.h.
|
inline |
Definition at line 54 of file kis_safe_read_list.h.
|
inline |
All the methods of this class are split into two groups: threadsafe and non-threadsafe. The methods from the first group can be called concurrently with each other. The ones form the other group can't be called concurrently (even with the friends from the first group) and must have an exclusive access to the list. The thread-safe group
Definition at line 46 of file kis_safe_read_list.h.
|
inline |
Definition at line 50 of file kis_safe_read_list.h.