replaced usleep() by rstime::rs_usleep() which accepts times >= 1 sec. Should fix problems on windows

This commit is contained in:
csoler 2018-01-27 20:22:31 +01:00
parent c1fccef53b
commit d0039241d3
28 changed files with 134 additions and 100 deletions

View file

@ -35,7 +35,7 @@
#include <algorithm>
#ifdef RS_DATA_SERVICE_DEBUG_TIME
#include <util/rsscopetimer.h>
#include <util/rstime.h>
#endif
#include "rsdataservice.h"
@ -1066,7 +1066,7 @@ bool RsDataService::validSize(RsNxsGrp* grp) const
int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool withMeta, bool /* cache */)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
int requestedGroups = grp.size();
#endif
@ -1166,7 +1166,7 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>
int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, bool /* cache */, bool withMeta)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1254,7 +1254,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1341,7 +1341,7 @@ int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
int requestedGroups = grp.size();
#endif
@ -1549,7 +1549,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1586,7 +1586,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif

View file

@ -31,6 +31,7 @@
#include "gxssecurity.h"
#include "util/contentvalue.h"
#include "util/rsprint.h"
#include "util/rstime.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsgxscircles.h"
#include "retroshare/rsgrouter.h"
@ -138,7 +139,7 @@ void RsGenExchange::data_tick()
static const double timeDelta = 0.1; // slow tick in sec
tick();
usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
rstime::rs_usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
}
void RsGenExchange::tick()

View file

@ -210,6 +210,7 @@
#include "retroshare/rspeers.h"
#include "pgp/pgpauxutils.h"
#include "util/rsdir.h"
#include "util/rstime.h"
#include "util/rsmemory.h"
#include "util/stacktrace.h"
@ -1787,7 +1788,7 @@ void RsGxsNetService::data_tick()
static const double timeDelta = 0.5;
//Start waiting as nothing to do in runup
usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
rstime::rs_usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
if(mUpdateCounter >= 120) // 60 seconds
{