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

@ -61,8 +61,8 @@ FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, std::string cachedir, cons
mForceCheck(false), mInCheck(false), hashCache(config_dir+"/" + "file_cache"),useHashCache(true)
{
updatePeriod = 15 * 60; // 15 minutes
reference_time = 0 ;
updatePeriod = 15 * 60; // 15 minutes
reference_time = 0 ;
}
bool FileIndexMonitor::autoCheckEnabled() const
@ -622,15 +622,13 @@ void FileIndexMonitor::setPeriod(int period)
#endif
}
void FileIndexMonitor::run()
void FileIndexMonitor::data_tick()
{
if(autoCheckEnabled())
updateCycle();
if(autoCheckEnabled())
updateCycle();
while(isRunning())
{
int i=0 ;
for(;;++i)
int i=0 ;
for(;;++i)
{
if(!isRunning())
return;
@ -651,7 +649,6 @@ void FileIndexMonitor::run()
if(i < abs(updatePeriod) || autoCheckEnabled())
updateCycle();
}
}
void FileIndexMonitor::updateCycle()

View file

@ -103,7 +103,7 @@ class HashCache
* FileIndexMonitor
*****************************************************************************************/
class FileIndexMonitor: public CacheSource, public RsThread
class FileIndexMonitor: public CacheSource, public RsTickingThread
{
public:
FileIndexMonitor(CacheStrapper *cs, std::string cachedir, const RsPeerId& pid, const std::string& config_dir);
@ -131,7 +131,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
/* the FileIndexMonitor inner workings */
//virtual void run(std::string& currentJob); /* overloaded from RsThread */
//void updateCycle(std::string& currentJob);
virtual void run(); /* overloaded from RsThread */
virtual void data_tick(); /* overloaded from RsThread */
void updateCycle();
// Interface for browsing dir hirarchy