winedos: Release the 16-bit lock before calling ExitThread.
This avoids deadlocks with the loader lock.
This commit is contained in:
parent
a6aa7771d3
commit
c5bdfdfb2d
|
@ -352,6 +352,7 @@ extern BOOL WINAPI MZ_Current( void );
|
||||||
extern void WINAPI MZ_AllocDPMITask( void );
|
extern void WINAPI MZ_AllocDPMITask( void );
|
||||||
extern void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg );
|
extern void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg );
|
||||||
extern BOOL DOSVM_IsWin16(void);
|
extern BOOL DOSVM_IsWin16(void);
|
||||||
|
extern void DOSVM_Exit( WORD retval );
|
||||||
|
|
||||||
/* dosvm.c */
|
/* dosvm.c */
|
||||||
extern void DOSVM_SendQueuedEvents( CONTEXT86 * );
|
extern void DOSVM_SendQueuedEvents( CONTEXT86 * );
|
||||||
|
|
|
@ -4176,7 +4176,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
||||||
case 0x00: /* TERMINATE PROGRAM */
|
case 0x00: /* TERMINATE PROGRAM */
|
||||||
TRACE("TERMINATE PROGRAM\n");
|
TRACE("TERMINATE PROGRAM\n");
|
||||||
if (DOSVM_IsWin16())
|
if (DOSVM_IsWin16())
|
||||||
ExitThread( 0 );
|
DOSVM_Exit( 0 );
|
||||||
else if(ISV86(context))
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, FALSE, 0 );
|
MZ_Exit( context, FALSE, 0 );
|
||||||
else
|
else
|
||||||
|
@ -5050,7 +5050,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
||||||
case 0x4c: /* "EXIT" - TERMINATE WITH RETURN CODE */
|
case 0x4c: /* "EXIT" - TERMINATE WITH RETURN CODE */
|
||||||
TRACE( "EXIT with return code %d\n", AL_reg(context) );
|
TRACE( "EXIT with return code %d\n", AL_reg(context) );
|
||||||
if (DOSVM_IsWin16())
|
if (DOSVM_IsWin16())
|
||||||
ExitThread( AL_reg(context) );
|
DOSVM_Exit( AL_reg(context) );
|
||||||
else if(ISV86(context))
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, FALSE, AL_reg(context) );
|
MZ_Exit( context, FALSE, AL_reg(context) );
|
||||||
else
|
else
|
||||||
|
|
|
@ -626,11 +626,11 @@ static void StartPM( CONTEXT86 *context )
|
||||||
TRACE( "Protected mode DOS program is terminating\n" );
|
TRACE( "Protected mode DOS program is terminating\n" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Instead of calling ExitThread, we should release all
|
* FIXME: Instead of calling DOSVM_Exit, we should release all
|
||||||
* allocated protected mode resources and call MZ_Exit
|
* allocated protected mode resources and call MZ_Exit
|
||||||
* using real mode context. See DPMI specification.
|
* using real mode context. See DPMI specification.
|
||||||
*/
|
*/
|
||||||
ExitThread( DPMI_retval );
|
DOSVM_Exit( DPMI_retval );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
wine_ldt_free_entries( psp->environment, 1 );
|
wine_ldt_free_entries( psp->environment, 1 );
|
||||||
|
|
|
@ -951,7 +951,7 @@ static void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context )
|
||||||
static void WINAPI DOSVM_Int20Handler( CONTEXT86 *context )
|
static void WINAPI DOSVM_Int20Handler( CONTEXT86 *context )
|
||||||
{
|
{
|
||||||
if (DOSVM_IsWin16())
|
if (DOSVM_IsWin16())
|
||||||
ExitThread( 0 );
|
DOSVM_Exit( 0 );
|
||||||
else if(ISV86(context))
|
else if(ISV86(context))
|
||||||
MZ_Exit( context, TRUE, 0 );
|
MZ_Exit( context, TRUE, 0 );
|
||||||
else
|
else
|
||||||
|
|
|
@ -64,6 +64,18 @@ BOOL DOSVM_IsWin16(void)
|
||||||
return DOSVM_isdosexe ? FALSE : TRUE;
|
return DOSVM_isdosexe ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* DOSVM_Exit
|
||||||
|
*/
|
||||||
|
void DOSVM_Exit( WORD retval )
|
||||||
|
{
|
||||||
|
DWORD count;
|
||||||
|
|
||||||
|
ReleaseThunkLock( &count );
|
||||||
|
ExitThread( retval );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef MZ_SUPPORTED
|
#ifdef MZ_SUPPORTED
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MMAN_H
|
#ifdef HAVE_SYS_MMAN_H
|
||||||
|
@ -731,7 +743,7 @@ void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
|
||||||
} else
|
} else
|
||||||
TRACE("killing DOS task\n");
|
TRACE("killing DOS task\n");
|
||||||
}
|
}
|
||||||
ExitThread( retval );
|
DOSVM_Exit( retval );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -785,7 +797,7 @@ void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg )
|
||||||
*/
|
*/
|
||||||
void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
|
void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval )
|
||||||
{
|
{
|
||||||
ExitThread( retval );
|
DOSVM_Exit( retval );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue