mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 06:05:49 -06:00
fix frmStatus freeze
При закрытии одного из окон frmStatus приложение зависало.
This commit is contained in:
parent
40a2623647
commit
3bad8c07f3
2 changed files with 18 additions and 11 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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<wxString> *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<wxString> log_queue;
|
||||
wxDateTime logfileTimestamp, latestTimestamp;
|
||||
wxString logDirectory, logfileName;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue