Don't timeout on a Wait() if a dialog is showing. The movie decode semaphone would timeout on most dialogs.

Increase Win32 semaphone timeout from 15 -> 60 secs.
This commit is contained in:
Chris Danford
2004-08-07 21:38:54 +00:00
parent 1d0dff5ad5
commit d755e660a6
3 changed files with 27 additions and 2 deletions
+22
View File
@@ -19,6 +19,7 @@
static DialogDriver *g_pImpl = NULL;
static DialogDriverNull g_pNullDriver;
static bool g_bWindowed = false;
static bool g_bIsShowingDialog = false;
void Dialog::Init()
{
@@ -59,6 +60,11 @@ void Dialog::Shutdown()
g_pImpl = NULL;
}
bool Dialog::IsShowingDialog()
{
return g_bIsShowingDialog;
}
static bool MessageIsIgnored( CString ID )
{
vector<CString> list;
@@ -100,7 +106,11 @@ void Dialog::Error( CString sMessage, CString ID )
if( ID != "" && MessageIsIgnored( ID ) )
return;
g_bIsShowingDialog = true;
g_pImpl->Error( sMessage, ID );
g_bIsShowingDialog = false;
}
void Dialog::SetWindowed( bool bWindowed )
@@ -115,11 +125,15 @@ void Dialog::OK( CString sMessage, CString ID )
if( ID != "" && MessageIsIgnored( ID ) )
return;
g_bIsShowingDialog = true;
// only show Dialog if windowed
if( !g_bWindowed )
g_pNullDriver.OK( sMessage, ID );
else
g_pImpl->OK( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
}
Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
@@ -129,11 +143,15 @@ Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
if( ID != "" && MessageIsIgnored( ID ) )
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
g_bIsShowingDialog = true;
// only show Dialog if windowed
if( !g_bWindowed )
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
else
return g_pImpl->AbortRetryIgnore( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
}
Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
@@ -143,11 +161,15 @@ Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
if( ID != "" && MessageIsIgnored( ID ) )
return g_pNullDriver.RetryCancel( sMessage, ID );
g_bIsShowingDialog = true;
// only show Dialog if windowed
if( !g_bWindowed )
return g_pNullDriver.RetryCancel( sMessage, ID );
else
return g_pImpl->RetryCancel( sMessage, ID ); // call derived version
g_bIsShowingDialog = false;
}
/*
+1
View File
@@ -9,6 +9,7 @@ namespace Dialog
void Shutdown();
void SetWindowed( bool bWindowed );
bool IsShowingDialog();
enum Result { abort, retry, ignore, cancel };
void Error( CString error, CString ID = "" );
+4 -2
View File
@@ -188,12 +188,14 @@ void SemaImpl_Win32::Post()
bool SemaImpl_Win32::Wait()
{
int len = 15000;
int len = 60000;
int tries = 2;
while( tries-- )
{
/* Wait for fifteen seconds. If it takes longer than that, we're probably deadlocked. */
/* Wait for 60 seconds. In debug builds, some screens may take longer
* than 15 seconds to load. If it takes longer than that, we're
* probably deadlocked. */
if( SimpleWaitForSingleObject( sem, len ) )
{
--m_iCounter;