diff --git a/frm/frmStatus.cpp b/frm/frmStatus.cpp index 71f4ae0..b973499 100644 --- a/frm/frmStatus.cpp +++ b/frm/frmStatus.cpp @@ -630,8 +630,8 @@ frmStatus::~frmStatus() logThread->BreakRead(); wxMilliSleep(50); logThread->DoTerminate(); - s_CloseLog.Wait(); - logThread = NULL; + //s_CloseLog.Wait(); + while (logThread != NULL) wxMilliSleep(50) ; } if (logconn) { @@ -2543,8 +2543,9 @@ void frmStatus::OnRefreshLogTimer(wxTimerEvent& event) logThread->BreakRead(); wxMilliSleep(50); logThread->DoTerminate(); - s_CloseLog.Wait(); - logThread = NULL; + wxMilliSleep(5); + //s_CloseLog.Wait(); + while (logThread != NULL) wxMilliSleep(5); } return; } @@ -3537,7 +3538,8 @@ void frmStatus::OnLoadLogfile(wxCommandEvent& event) } } ReadLogThread::~ReadLogThread() { - s_CloseLog.Post(); + //s_CloseLog.Post(); + ((frmStatus *) theParent)->logThread = NULL; } void ReadLogThread::BreakRead() { if (!isReadyRows()) { diff --git a/include/frm/frmStatus.h b/include/frm/frmStatus.h index cf6c141..18541ca 100644 --- a/include/frm/frmStatus.h +++ b/include/frm/frmStatus.h @@ -102,16 +102,17 @@ static wxCriticalSection gs_critsect; // Class declarations -static wxMutex s_mutexDBLogReading; -static wxSemaphore s_goReadLog(0, 1); -static wxSemaphore s_ResultOkLog(0, 1); -static wxSemaphore s_CloseLog(0, 1); +//static wxSemaphore s_CloseLog(0, 1); class ReadLogThread : public wxThread { public: ReadLogThread(pgConn *conlog, wxWindow* p, wxMessageQueue *queue) { + //wxSemaphore goReadLog(0,1); + //wxSemaphore ResultOkLog(0, 1); + //s_goReadLog=goReadLog; + //s_ResultOkLog = ResultOkLog; log_queue = queue; theParent = p; @@ -165,6 +166,10 @@ private: e.SetString(s); theParent->GetEventHandler()->AddPendingEvent(e); } + wxMutex s_mutexDBLogReading; + wxSemaphore s_goReadLog; + wxSemaphore s_ResultOkLog; + wxDateTime nextrun; wxWindow* theParent; bool m_exit = false; @@ -187,7 +192,7 @@ public: ~frmStatus(); void Go(); bool getTextSqlbyQid(long long qid); - + ReadLogThread* logThread = NULL; private: wxAuiManager manager; @@ -198,7 +203,7 @@ private: bool logHasTimestamp, logFormatKnown; int logFmtPos; long logFinditem=-1; - ReadLogThread *logThread=NULL; + wxMessageQueue log_queue; wxDateTime logfileTimestamp, latestTimestamp; wxString logDirectory, logfileName;