mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
prevent lockups on exit
This commit is contained in:
parent
2a62f816d5
commit
631392688f
@ -302,6 +302,8 @@ UpdateGUI (void *arg)
|
||||
* progress bar showing % completion, or a throbber that only shows that an
|
||||
* action is in progress.
|
||||
***************************************************************************/
|
||||
static int progsleep = 0;
|
||||
|
||||
static void
|
||||
ProgressWindow(char *title, char *msg)
|
||||
{
|
||||
@ -364,7 +366,17 @@ ProgressWindow(char *title, char *msg)
|
||||
promptWindow.Append(&throbberImg);
|
||||
}
|
||||
|
||||
usleep(400000); // wait to see if progress flag changes soon
|
||||
// wait to see if progress flag changes soon
|
||||
progsleep = 400000;
|
||||
|
||||
while(progsleep > 0)
|
||||
{
|
||||
if(!showProgress)
|
||||
break;
|
||||
usleep(THREAD_SLEEP);
|
||||
progsleep -= THREAD_SLEEP;
|
||||
}
|
||||
|
||||
if(!showProgress)
|
||||
return;
|
||||
|
||||
@ -380,7 +392,15 @@ ProgressWindow(char *title, char *msg)
|
||||
|
||||
while(showProgress)
|
||||
{
|
||||
usleep(20000);
|
||||
progsleep = 20000;
|
||||
|
||||
while(progsleep > 0)
|
||||
{
|
||||
if(!showProgress)
|
||||
break;
|
||||
usleep(THREAD_SLEEP);
|
||||
progsleep -= THREAD_SLEEP;
|
||||
}
|
||||
|
||||
if(showProgress == 1)
|
||||
{
|
||||
@ -456,7 +476,7 @@ CancelAction()
|
||||
void
|
||||
ShowProgress (const char *msg, int done, int total)
|
||||
{
|
||||
if(!mainWindow)
|
||||
if(!mainWindow || ExitRequested || ShutdownRequested)
|
||||
return;
|
||||
|
||||
if(total < (256*1024))
|
||||
@ -487,7 +507,7 @@ ShowProgress (const char *msg, int done, int total)
|
||||
void
|
||||
ShowAction (const char *msg)
|
||||
{
|
||||
if(!mainWindow)
|
||||
if(!mainWindow || ExitRequested || ShutdownRequested)
|
||||
return;
|
||||
|
||||
if(showProgress != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user