Preview error handle.5

This commit is contained in:
Krad
2022-06-02 16:09:42 +08:00
parent c9c021de6f
commit 8e70bd7e3f
3 changed files with 31 additions and 19 deletions

View File

@@ -27,20 +27,26 @@ volatile int running = 1;
volatile int progress = 0;
volatile int status = READY;
volatile int stop_flag = 0;
volatile int empty = 0;
char output_path[256] = {0};
void ThreadFunc(void* args){
while (running){
WaitForSingleObject(e1, INFINITE);
status = SCANNING;
stop_flag = 0;
progress = 0;
for (int i = 0; i <= 50; ++i) {
if (stop_flag > 0){
stop_flag = 0;
break;
}
progress = 0;
WaitForSingleObject(e1, INFINITE);
status = SCANNING;
Sleep(300);
if (empty)
{
GetPreviewData();
}
for (int i = 0; i <= 50; ++i) {
if (stop_flag > 0 || status != SCANNING){
stop_flag = 0;
break;
}
if (i == 20){
progress = 139;
WaitForSingleObject(e2, INFINITE);
@@ -53,6 +59,10 @@ void ThreadFunc(void* args){
}
else{
progress = i *2;
}
if (stop_flag > 0 || status != SCANNING){
stop_flag = 0;
break;
}
Sleep(300);
}
@@ -107,7 +117,8 @@ StatusInfo GetStatus() {
}
//result, 0 success, other false
int SetScanInfo(const char* jsonString, int empty) {
int SetScanInfo(const char* jsonString, int e) {
empty = e;
return 0;
}