created 2 subclasses of RsThread, one for ticking services, and one for single shot jobs. Now all threads use the same base code.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8288 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-05-22 20:54:38 +00:00
parent f2d4a237ca
commit e9b9dce9f5
28 changed files with 317 additions and 335 deletions

View file

@ -130,6 +130,7 @@ AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& pa
{
_force_sync_database = false ;
start();
int mCount = 0;
}
/* This function is called when retroshare is first started
@ -178,30 +179,26 @@ int AuthGPG::GPGInit(const RsPgpId &ownId)
{
}
void AuthGPG::run()
void AuthGPG::data_tick()
{
int count = 0;
usleep(100 * 1000); //100 msec
while (isRunning()) {
usleep(100 * 1000); //100 msec
/// every 100 milliseconds
processServices();
/// every 100 milliseconds
processServices();
/// every ten seconds
if (++mCount >= 100 || _force_sync_database) {
RsStackMutex stack(gpgMtxService); ///******* LOCKED ******
/// every ten seconds
if (++count >= 100 || _force_sync_database) {
RsStackMutex stack(gpgMtxService); ///******* LOCKED ******
/// The call does multiple things at once:
/// - checks whether the keyring has changed in memory
/// - checks whether the keyring has changed on disk.
/// - merges/updates according to status.
///
PGPHandler::syncDatabase() ;
count = 0;
_force_sync_database = false ;
}//if (++count >= 100 || _force_sync_database)
}//while (isRunning())
/// The call does multiple things at once:
/// - checks whether the keyring has changed in memory
/// - checks whether the keyring has changed on disk.
/// - merges/updates according to status.
///
PGPHandler::syncDatabase() ;
mCount = 0;
_force_sync_database = false ;
}//if (++count >= 100 || _force_sync_database)
}
void AuthGPG::processServices()