mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 00:45:34 -04:00
Cleanup RsThread and related classes
Removed antipattern abstraction RsSingleJobThread Rename runloop() method to run() in RsThread Ported few classes ineriting from RsSingleJobThread to RsThread RsThread use std::atomic instead of self implemented strange binary semaphores Removed RsTickingThread::shutdown() use RsThread::askForStop() instead Removed RsTickingThread::fullstop() use RsThread::fullstop() instead Stop properly JSON API server in retroshare-gui Centralize errno traslation to literal in util/rserrno.*
This commit is contained in:
parent
358aa1e0ab
commit
df87fe53b1
43 changed files with 490 additions and 587 deletions
|
@ -209,7 +209,7 @@ void ftController::removeFileSource(const RsFileHash& hash,const RsPeerId& peer_
|
|||
std::cerr << "... not added: hash not found." << std::endl ;
|
||||
#endif
|
||||
}
|
||||
void ftController::data_tick()
|
||||
void ftController::threadTick()
|
||||
{
|
||||
/* check the queues */
|
||||
|
||||
|
|
|
@ -109,9 +109,10 @@ class ftPendingRequest
|
|||
};
|
||||
|
||||
|
||||
class ftController: public RsTickingThread, public pqiServiceMonitor, public p3Config
|
||||
class ftController:
|
||||
public RsTickingThread, public pqiServiceMonitor, public p3Config
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
/* Setup */
|
||||
ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId);
|
||||
|
@ -122,7 +123,7 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
|||
bool activate();
|
||||
bool isActiveAndNoPending();
|
||||
|
||||
virtual void data_tick();
|
||||
void threadTick() override; /// @see RsTickingThread
|
||||
|
||||
/***************************************************************/
|
||||
/********************** Controller Access **********************/
|
||||
|
|
|
@ -47,7 +47,7 @@ ftExtraList::ftExtraList()
|
|||
}
|
||||
|
||||
|
||||
void ftExtraList::data_tick()
|
||||
void ftExtraList::threadTick()
|
||||
{
|
||||
bool todo = false;
|
||||
rstime_t now = time(NULL);
|
||||
|
|
|
@ -146,10 +146,7 @@ public:
|
|||
*/
|
||||
void getExtraFileList(std::vector<FileInfo>& files) const ;
|
||||
|
||||
/***
|
||||
* Thread Main Loop
|
||||
**/
|
||||
virtual void data_tick();
|
||||
void threadTick() override; /// @see RsTickingThread
|
||||
|
||||
/***
|
||||
* Configuration - store extra files.
|
||||
|
|
|
@ -234,28 +234,28 @@ void ftServer::StartupThreads()
|
|||
void ftServer::StopThreads()
|
||||
{
|
||||
/* stop Dataplex */
|
||||
mFtDataplex->join();
|
||||
mFtDataplex->fullstop();
|
||||
|
||||
/* stop Controller thread */
|
||||
mFtController->join();
|
||||
mFtController->fullstop();
|
||||
|
||||
/* self contained threads */
|
||||
/* stop ExtraList Thread */
|
||||
mFtExtra->join();
|
||||
mFtExtra->fullstop();
|
||||
|
||||
delete (mFtDataplex);
|
||||
mFtDataplex = NULL;
|
||||
mFtDataplex = nullptr;
|
||||
|
||||
delete (mFtController);
|
||||
mFtController = NULL;
|
||||
mFtController = nullptr;
|
||||
|
||||
delete (mFtExtra);
|
||||
mFtExtra = NULL;
|
||||
mFtExtra = nullptr;
|
||||
|
||||
/* stop Monitor Thread */
|
||||
mFileDatabase->stopThreads();
|
||||
delete mFileDatabase;
|
||||
mFileDatabase = NULL ;
|
||||
mFileDatabase = nullptr;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
|
|
@ -544,7 +544,7 @@ bool ftTransferModule::isCheckingHash()
|
|||
return mFlag == FT_TM_FLAG_CHECKING || mFlag == FT_TM_FLAG_CHUNK_CRC;
|
||||
}
|
||||
|
||||
class HashThread: public RsSingleJobThread
|
||||
class HashThread: public RsThread
|
||||
{
|
||||
public:
|
||||
explicit HashThread(ftFileCreator *m)
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
Status stat;
|
||||
};
|
||||
|
||||
class ftTransferModule
|
||||
class ftTransferModule
|
||||
{
|
||||
public:
|
||||
ftTransferModule(ftFileCreator *fc, ftDataMultiplex *dm, ftController *c);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue