djvm hangs when running multiple times on the same document.
Tested with Windows 10 with 3.5.28 and 3.5.29
Steps to reproduce:
Create some test image test.pbm
Run this batch script:
echo off
cjb2 test.pbm test.djvu
djvm -c doc.djvu test.djvu
for /L %%n in (1,1,1000) do (
echo %%n
djvm -i doc.djvu test.djvu > nul
)
pause
or this:
echo off
cjb2 test.pbm test.djvu
for /L %%n in (1,1,1000) do (
echo %%n
djvm -c doc.djvu test.djvu
for /L %%m in (1,1,100) do (
djvm -i doc.djvu test.djvu
)
)
pause
It's hard to reproduce with x86 build but it's extremely easy to get the issue if you compile djvulibre for ARM64 and run on Windows On ARM.
I tried to debug this with version 3.5.28 (VS2019, x86, 32bit) and found that it stucks on trying to wait for the event for an infinite time https://sourceforge.net/p/djvu/djvulibre-git/ci/master/tree/libdjvu/GThreads.cpp#l302 (see attached screenshots). As I understand this code should work the same as conditional variables in posix. I never worked with conditional variables. But it looks like you create unsignalled event and eventually try to wait for it for an infinite time. Which can last forever because no other threads know about this event.
Maybe this code should be rewritted to use Vista+ conditional variables as djvulibre doesn't work on WinXP for at least 2 releases.