qt5base-lts/tests/auto/qfreelist
Bradley T. Hughes 6b82798ee7 Add QFreeList as an internal class
This is a generic implementation of the lock-free free list found in
qabstracteventdispatcher.cpp. Use next() to get the next free entry in
the list, and release(id) when done with the id.

This version is templated and allows having a payload which can be
accessed using the id returned by next(). The payload is allocated and
deallocated automatically by the free list, but *NOT* when calling
next()/release(). Initialization should be done by code needing it after
next() returns. Likewise, cleanup should happen before calling
release(). It is possible to have use 'void' as the payload type, in
which case the free list only contains indexes to the next free entry.

Autotest included.

Change-Id: Ifd12a961d47f3d76593c45061f72e55c9b80a43b
Reviewed-on: http://codereview.qt.nokia.com/2160
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
2011-07-26 13:40:07 +02:00
..
qfreelist.pro Add QFreeList as an internal class 2011-07-26 13:40:07 +02:00
tst_qfreelist.cpp Add QFreeList as an internal class 2011-07-26 13:40:07 +02:00