|
@@ -48,6 +48,9 @@ DWORD __stdcall CScriptExecutor::_WorkerThread(LPVOID lpParam)
|
|
|
that->RunScripProcess();
|
|
|
}
|
|
|
|
|
|
+ CloseHandle(that->m_hWorkThread);
|
|
|
+ that->m_hWorkThread = NULL;
|
|
|
+
|
|
|
// 线程结束后,应该回调一个通知函数;
|
|
|
// ...
|
|
|
|
|
@@ -69,13 +72,6 @@ DWORD __stdcall CScriptExecutor::_LogExportThread(LPVOID lpParam)
|
|
|
CHAR chBuf[BUFSIZE] = {0};
|
|
|
BOOL bSuccess = FALSE;
|
|
|
HANDLE hParentStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
-
|
|
|
- for (;;)
|
|
|
- {
|
|
|
- if (that->m_hStdOutRead)
|
|
|
- break;
|
|
|
- Sleep(100);
|
|
|
- }
|
|
|
|
|
|
do
|
|
|
{
|
|
@@ -87,6 +83,16 @@ DWORD __stdcall CScriptExecutor::_LogExportThread(LPVOID lpParam)
|
|
|
memset(chBuf, 0, BUFSIZE);
|
|
|
} while (!that->m_bStopLogExport);
|
|
|
}
|
|
|
+ else if ( that->m_nRunType == PY_RUN_TYPE::EMBEDDED)
|
|
|
+ {
|
|
|
+ do
|
|
|
+ {
|
|
|
+ Sleep(20);
|
|
|
+ } while (!that->m_bStopLogExport);
|
|
|
+ }
|
|
|
+
|
|
|
+ CloseHandle(that->m_hLogThread);
|
|
|
+ that->m_hLogThread = NULL;
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -541,3 +547,19 @@ void CScriptExecutor::StopScript()
|
|
|
// 结束线程;
|
|
|
EndWorkThread();
|
|
|
}
|
|
|
+
|
|
|
+bool CScriptExecutor::IsScriptOver()
|
|
|
+{
|
|
|
+ if (m_nRunType == PY_RUN_TYPE::EMBEDDED)
|
|
|
+ {
|
|
|
+ if ( m_hWorkThread == NULL )
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if (m_nRunType == PY_RUN_TYPE::SUBPROCESS)
|
|
|
+ {
|
|
|
+ if ( m_pi.hProcess == NULL && m_hWorkThread == NULL )
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|