Changed: Renamed thread to Thread and assign InstallThread and DownloadThread

This commit is contained in:
kervala 2016-12-04 17:19:37 +01:00
parent 162b9e182b
commit 11b56a7e6d
2 changed files with 37 additions and 35 deletions

View file

@ -143,7 +143,8 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st
CheckThread = NULL; CheckThread = NULL;
InstallThread = NULL; InstallThread = NULL;
ScanDataThread = NULL; ScanDataThread = NULL;
thread = NULL; DownloadThread = NULL;
Thread = NULL;
LogSeparator = "\n"; LogSeparator = "\n";
ValidDescFile = false; ValidDescFile = false;
@ -364,7 +365,7 @@ void CPatchManager::startCheckThread(bool includeBackgroundPatch)
nlwarning ("check thread is already running"); nlwarning ("check thread is already running");
return; return;
} }
if (thread != NULL) if (Thread != NULL)
{ {
nlwarning ("a thread is already running"); nlwarning ("a thread is already running");
return; return;
@ -375,9 +376,9 @@ void CPatchManager::startCheckThread(bool includeBackgroundPatch)
CheckThread = new CCheckThread(includeBackgroundPatch); CheckThread = new CCheckThread(includeBackgroundPatch);
nlassert (CheckThread != NULL); nlassert (CheckThread != NULL);
thread = IThread::create (CheckThread); Thread = IThread::create (CheckThread);
nlassert (thread != NULL); nlassert (Thread != NULL);
thread->start (); Thread->start ();
} }
// **************************************************************************** // ****************************************************************************
@ -402,11 +403,11 @@ bool CPatchManager::isCheckThreadEnded(bool &ok)
// **************************************************************************** // ****************************************************************************
void CPatchManager::stopCheckThread() void CPatchManager::stopCheckThread()
{ {
if(CheckThread && thread) if(CheckThread && Thread)
{ {
thread->wait(); Thread->wait();
delete thread; delete Thread;
thread = NULL; Thread = NULL;
delete CheckThread; delete CheckThread;
CheckThread = NULL; CheckThread = NULL;
} }
@ -534,7 +535,7 @@ void CPatchManager::startPatchThread(const vector<string> &CategoriesSelected, b
nlwarning ("check thread is already running"); nlwarning ("check thread is already running");
return; return;
} }
if (thread != NULL) if (Thread != NULL)
{ {
nlwarning ("a thread is already running"); nlwarning ("a thread is already running");
return; return;
@ -622,9 +623,9 @@ void CPatchManager::startPatchThread(const vector<string> &CategoriesSelected, b
} }
// Launch the thread // Launch the thread
thread = IThread::create (PatchThread); Thread = IThread::create (PatchThread);
nlassert (thread != NULL); nlassert (Thread != NULL);
thread->start (); Thread->start ();
} }
// **************************************************************************** // ****************************************************************************
@ -685,11 +686,11 @@ bool CPatchManager::getThreadState (ucstring &stateOut, vector<ucstring> &stateL
// **************************************************************************** // ****************************************************************************
void CPatchManager::stopPatchThread() void CPatchManager::stopPatchThread()
{ {
if(PatchThread && thread) if(PatchThread && Thread)
{ {
thread->wait(); Thread->wait();
delete thread; delete Thread;
thread = NULL; Thread = NULL;
delete PatchThread; delete PatchThread;
PatchThread = NULL; PatchThread = NULL;
} }
@ -1944,7 +1945,7 @@ void CPatchManager::startScanDataThread()
nlwarning ("scan data thread is already running"); nlwarning ("scan data thread is already running");
return; return;
} }
if (thread != NULL) if (Thread != NULL)
{ {
nlwarning ("a thread is already running"); nlwarning ("a thread is already running");
return; return;
@ -1962,9 +1963,9 @@ void CPatchManager::startScanDataThread()
ScanDataThread = new CScanDataThread(); ScanDataThread = new CScanDataThread();
nlassert (ScanDataThread != NULL); nlassert (ScanDataThread != NULL);
thread = IThread::create (ScanDataThread); Thread = IThread::create (ScanDataThread);
nlassert (thread != NULL); nlassert (Thread != NULL);
thread->start (); Thread->start ();
} }
// **************************************************************************** // ****************************************************************************
@ -1989,11 +1990,11 @@ bool CPatchManager::isScanDataThreadEnded(bool &ok)
// **************************************************************************** // ****************************************************************************
void CPatchManager::stopScanDataThread() void CPatchManager::stopScanDataThread()
{ {
if(ScanDataThread && thread) if(ScanDataThread && Thread)
{ {
thread->wait(); Thread->wait();
delete thread; delete Thread;
thread = NULL; Thread = NULL;
delete ScanDataThread; delete ScanDataThread;
ScanDataThread = NULL; ScanDataThread = NULL;
} }
@ -3044,18 +3045,18 @@ IAsyncDownloader* CPatchManager::getAsyncDownloader() const
// **************************************************************************** // ****************************************************************************
void CPatchManager::startInstallThread(const std::vector<CInstallThreadEntry>& entries) void CPatchManager::startInstallThread(const std::vector<CInstallThreadEntry>& entries)
{ {
CInstallThread* installThread = new CInstallThread(entries); InstallThread = new CInstallThread(entries);
thread = IThread::create (installThread); Thread = IThread::create (InstallThread);
nlassert (thread != NULL); nlassert (Thread != NULL);
thread->start (); Thread->start ();
} }
void CPatchManager::startDownloadThread(const std::vector<CInstallThreadEntry>& entries) void CPatchManager::startDownloadThread(const std::vector<CInstallThreadEntry>& entries)
{ {
CDownloadThread* downloadThread = new CDownloadThread(entries); DownloadThread = new CDownloadThread(entries);
thread = IThread::create (downloadThread); Thread = IThread::create (DownloadThread);
nlassert (thread != NULL); nlassert (Thread != NULL);
thread->start (); Thread->start ();
} }

View file

@ -238,7 +238,7 @@ public:
CProductDescriptionForClient &getDescFile() { return DescFile; } CProductDescriptionForClient &getDescFile() { return DescFile; }
NLMISC::IThread *getCurrThread() const { return thread; } NLMISC::IThread *getCurrThread() const { return Thread; }
// set an external state listener (enable to log) infos // set an external state listener (enable to log) infos
void setStateListener(IPatchManagerStateListener* stateListener); void setStateListener(IPatchManagerStateListener* stateListener);
@ -410,7 +410,8 @@ private:
CCheckThread *CheckThread; CCheckThread *CheckThread;
CScanDataThread *ScanDataThread; CScanDataThread *ScanDataThread;
CInstallThread *InstallThread; CInstallThread *InstallThread;
NLMISC::IThread *thread; CDownloadThread *DownloadThread;
NLMISC::IThread *Thread;
// State // State
struct CState struct CState