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

@ -132,7 +132,7 @@ bool RsGenExchange::getGroupServerUpdateTS(const RsGxsGroupId& gid, rstime_t& gr
return mNetService->getGroupServerUpdateTS(gid,grp_server_update_TS,msg_server_update_TS) ;
}
void RsGenExchange::data_tick()
void RsGenExchange::threadTick()
{
static const double timeDelta = 0.1; // slow tick in sec

View file

@ -176,7 +176,7 @@ public:
*/
RsTokenService* getTokenService();
virtual void data_tick();
void threadTick() override; /// @see RsTickingThread
/*!
* Policy bit pattern portion

View file

@ -1981,7 +1981,7 @@ bool RsGxsNetService::locked_processTransac(RsNxsTransacItem *item)
return false;
}
void RsGxsNetService::data_tick()
void RsGxsNetService::threadTick()
{
static const double timeDelta = 0.5;

View file

@ -76,7 +76,8 @@ struct GroupRequestRecord
* Incoming transaction are in 3 different states
* 1. START 2. RECEIVING 3. END
*/
class RsGxsNetService : public RsNetworkExchangeService, public p3ThreadedService, public p3Config
class RsGxsNetService :
public RsNetworkExchangeService, public p3ThreadedService, public p3Config
{
public:
@ -207,10 +208,8 @@ public:
*/
int tick();
/*!
* Processes transactions and job queue
*/
virtual void data_tick();
void threadTick() override; /// @see RsTickingThread
private:
/*!

View file

@ -726,7 +726,7 @@ void RsGxsNetTunnelService::generateEncryptionKey(const RsGxsGroupId& group_id,c
// Service parts //
//===========================================================================================================================================//
void RsGxsNetTunnelService::data_tick()
void RsGxsNetTunnelService::threadTick()
{
while(!mPendingTurtleItems.empty())
{

View file

@ -103,7 +103,9 @@
class RsGxsNetTunnelItem ;
class RsNetworkExchangeService ;
class RsGxsNetTunnelService: public RsTurtleClientService, public RsTickingThread, public p3Config, public RsGxsDistSync
class RsGxsNetTunnelService:
public RsTurtleClientService, public RsTickingThread, public p3Config,
public RsGxsDistSync
{
public:
RsGxsNetTunnelService() ;
@ -196,9 +198,7 @@ public:
virtual bool receiveSearchRequest(unsigned char *search_request_data, uint32_t search_request_data_len, unsigned char *& search_result_data, uint32_t& search_result_data_len, uint32_t &max_allowed_hits);
virtual void receiveSearchResult(TurtleSearchRequestId request_id,unsigned char *search_result_data,uint32_t search_result_data_len);
// Overloaded from RsTickingThread
void data_tick() ;
void threadTick() override; /// @see RsTickingThread
// Overloads p3Config

View file

@ -183,7 +183,7 @@ private:
* Checks the integrity message and groups
* in rsDataService using computed hash
*/
class RsGxsIntegrityCheck : public RsSingleJobThread
class RsGxsIntegrityCheck : public RsThread
{
enum CheckState { CheckStart, CheckChecking };