Only the first thumbnail is rendered
tloockx-aim opened this issue · 3 comments
Thanks for creating such an incredible library!
I'm having issues displaying thumbnails. In my case, only the first thumbnail is ever displayed:
What I think is happening is that the thread running via m_ThreadThumbnailFileDatasExtractionFunc
is not waking up anymore after the first time (code link):
while (m_IsWorking) {
std::unique_lock<std::mutex> thumbnailFileDatasToGetLock(m_ThumbnailFileDatasToGetMutex);
// We wait here forever.
m_ThumbnailFileDatasToGetCv.wait(thumbnailFileDatasToGetLock);
if (!m_ThumbnailFileDatasToGet.empty()) {
The main thread puts all the required file data on the queue in one go and wakes up the thread, but this thread only processes one thumbnail before returning to sleep forever because nobody wakes it up again.
I can hack around this by having a timeout on the wait:
while (m_IsWorking) {
std::unique_lock<std::mutex> thumbnailFileDatasToGetLock(m_ThumbnailFileDatasToGetMutex);
// HACK: Wake up to check for thumbnails if nobody will wake us up!
m_ThumbnailFileDatasToGetCv.wait_for(thumbnailFileDatasToGetLock, std::chrono::milliseconds(50));
if (!m_ThumbnailFileDatasToGet.empty()) {
But I'm pretty sure that's not how you designed it to work.
np, its always interesting.
dont hesitate to let me know what was the issue (Thread Concurrency or File loading issue or what else !?), maybe if i can make something easier on my side.