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:
Gioacchino Mazzurco 2019-10-31 18:23:38 +01:00
parent 358aa1e0ab
commit df87fe53b1
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
43 changed files with 490 additions and 587 deletions

View file

@ -116,11 +116,11 @@ void AuthGPG::init(
void AuthGPG::exit()
{
if(_instance != NULL)
if(_instance)
{
_instance->join();
delete _instance ;
_instance = NULL;
_instance->fullstop();
delete _instance;
_instance = nullptr;
}
}
@ -188,7 +188,7 @@ int AuthGPG::GPGInit(const RsPgpId &ownId)
{
}
void AuthGPG::data_tick()
void AuthGPG::threadTick()
{
rstime::rs_usleep(100 * 1000); //100 msec

View file

@ -239,7 +239,7 @@ public:
virtual bool loadList(std::list<RsItem *>& load);
/*****************************************************************/
private:
private:
// Gets the certificate pointer and returns NULL if the string is invalid, or the
// cert was not found.
//
@ -271,10 +271,9 @@ public:
bool printAllKeys_locked();
bool printOwnKeys_locked();
/* own thread */
virtual void data_tick();
void threadTick() override; /// @see RsTickingThread
private:
private:
static AuthGPG *instance_gpg; // pointeur vers le singleton

View file

@ -366,9 +366,9 @@ int pqiperson::handleNotifyEvent_locked(NetInterface *ni, int newState,
<< " CONNECT_FAILED->marking so!" << std::endl;
#endif
activepqi->shutdown(); // STOP THREAD.
activepqi->askForStop(); // STOP THREAD.
active = false;
activepqi = NULL;
activepqi = nullptr;
}
#ifdef PERSON_DEBUG
else
@ -406,7 +406,7 @@ int pqiperson::reset_locked()
std::map<uint32_t, pqiconnect *>::iterator it;
for(it = kids.begin(); it != kids.end(); ++it)
{
(it->second) -> shutdown(); // STOP THREAD.
it->second->askForStop(); // STOP THREAD.
(it->second) -> reset();
}

View file

@ -49,7 +49,7 @@ int pqithreadstreamer::tick()
return 0;
}
void pqithreadstreamer::data_tick()
void pqithreadstreamer::threadTick()
{
uint32_t recv_timeout = 0;
uint32_t sleep_period = 0;

View file

@ -35,7 +35,7 @@ public:
virtual int tick();
protected:
virtual void data_tick();
void threadTick() override; /// @see RsTickingThread
PQInterface *mParent;
uint32_t mTimeout;