[Bug 38627] Holy Avatar vs. Maidens of the Dead hangs on exit

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Aug 12 01:30:20 CDT 2015


https://bugs.winehq.org/show_bug.cgi?id=38627

--- Comment #9 from Dmitry Timoshkov <dmitry at baikal.ru> ---
(In reply to Dmitry Timoshkov from comment #5)
> Another thing to investigate is a hang before Ctrl+C exception:
> 
> probably vBase90.dll:
> thread_proc()
> {
>     for(;;) WaitForSingleObject(hevent, INFINITE);
> }
> 
> hevent = CreateEvent(0,0,0,0);
> CreateThread(thread_proc);
> 
> vBase90.dll,PROCESS_DETACH:
> SetEvent(hevent); <= probably hangs here, there is no return before Ctrl+C

After looking at the vBase90.dll disassembly what application actually does
is slightly different:

vBase90.dll:
int var_to_test;
thread_proc()
{
    for(;;) WaitForSingleObject(hevent, INFINITE);
    var_to_test = 1;
}

var_to_test = 0;
hevent = CreateEvent(0,0,0,0);
CreateThread(thread_proc);
...
ExitProcess(0);
...
vBase90.dll,PROCESS_DETACH:
SetEvent(hevent);
while (var_to_test != 1) /* wait*/; <= hangs here

The applications expects that variable var_to_test is set by the thread
proc after the event is signalled, but all the threads are already dead
at the point of PROCESS_DETACH event, so the app hangs forever waiting for
the variable.

So far I failed to reproduce this application's expectation with a test
under Windows7, the thread gets killed before the PROCESS_DETACH event.
My guess was that the event could get an abandoned state during thread
termination by ExitProcess, so that WaitForSingleObejct() would return
and allow setting the variable, but so far I couldn't confirm that theory.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list