The swap pointer should be NULLed after being fetched by another thread. The getter function should get a mutex that protects the pointer while being NULLed. After the swap has occurred in the fetcher-thread, the pointer can be written back to the item. This guarantees that no other thread accesses the current swap pointer while one of the cache threads writes new image data.
Category Archives: lightbox
LightBox: Performance-Test
Using an OpenGL-Viewport, a curious behaviour takes place:
rendering ~1000 items (partially overlapping) is slow if they are painted directly onto the scene background.
If however an item covers the area they’re all in and lies in the background, rendering is a *lot* faster.
A performance test function should help determining bottlenecks in display performance:
void performanceTest(ETestMode mode)
{
// disable loading & rendering of textures
// create a grid of 200x200 items, non-overlapping
// or overlapping, depending on the mode
switch (mode)
{
case eNonOverlapping:
break;
case eOverlapping:
break;
default:
break;
}
}
LightBox: remove locks from gui thread
Locks should be eliminated in the gui thread if possible.
whenever an item requests an image via imageloader, it should just emit the job data via signal/slot or call the slot via queued connection instead of locking the job queue and entering the new job manually.