mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-28 03:31:49 +01:00
prevent lockups on exit
This commit is contained in:
parent
3aa5f2c9e2
commit
dbe234c052
@ -299,6 +299,8 @@ UpdateGUI (void *arg)
|
|||||||
* progress bar showing % completion, or a throbber that only shows that an
|
* progress bar showing % completion, or a throbber that only shows that an
|
||||||
* action is in progress.
|
* action is in progress.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
static int progsleep = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ProgressWindow(char *title, char *msg)
|
ProgressWindow(char *title, char *msg)
|
||||||
{
|
{
|
||||||
@ -361,7 +363,17 @@ ProgressWindow(char *title, char *msg)
|
|||||||
promptWindow.Append(&throbberImg);
|
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)
|
if(!showProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -377,7 +389,15 @@ ProgressWindow(char *title, char *msg)
|
|||||||
|
|
||||||
while(showProgress)
|
while(showProgress)
|
||||||
{
|
{
|
||||||
usleep(20000);
|
progsleep = 20000;
|
||||||
|
|
||||||
|
while(progsleep > 0)
|
||||||
|
{
|
||||||
|
if(!showProgress)
|
||||||
|
break;
|
||||||
|
usleep(THREAD_SLEEP);
|
||||||
|
progsleep -= THREAD_SLEEP;
|
||||||
|
}
|
||||||
|
|
||||||
if(showProgress == 1)
|
if(showProgress == 1)
|
||||||
{
|
{
|
||||||
@ -410,6 +430,7 @@ static void * ProgressThread (void *arg)
|
|||||||
LWP_SuspendThread (progressthread);
|
LWP_SuspendThread (progressthread);
|
||||||
|
|
||||||
ProgressWindow(progressTitle, progressMsg);
|
ProgressWindow(progressTitle, progressMsg);
|
||||||
|
usleep(THREAD_SLEEP);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -452,7 +473,7 @@ CancelAction()
|
|||||||
void
|
void
|
||||||
ShowProgress (const char *msg, int done, int total)
|
ShowProgress (const char *msg, int done, int total)
|
||||||
{
|
{
|
||||||
if(!mainWindow)
|
if(!mainWindow || ExitRequested || ShutdownRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(total < (256*1024))
|
if(total < (256*1024))
|
||||||
@ -483,7 +504,7 @@ ShowProgress (const char *msg, int done, int total)
|
|||||||
void
|
void
|
||||||
ShowAction (const char *msg)
|
ShowAction (const char *msg)
|
||||||
{
|
{
|
||||||
if(!mainWindow)
|
if(!mainWindow || ExitRequested || ShutdownRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(showProgress != 0)
|
if(showProgress != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user