mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 11:54:22 -04:00
fixed threading issue in NxsTestHub. NxsTesthub has to wait for its own thread to shut down on test end.
This commit is contained in:
parent
63c6629e57
commit
a8b2bc776e
2 changed files with 10 additions and 28 deletions
|
@ -104,24 +104,6 @@ bool rs_nxs_test::NxsTestHub::testsPassed()
|
||||||
return mTestScenario->checkTestPassed();
|
return mTestScenario->checkTestPassed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void rs_nxs_test::NxsTestHub::runloop()
|
|
||||||
{
|
|
||||||
double timeDelta = .2;
|
|
||||||
while(!shouldStop())
|
|
||||||
{
|
|
||||||
#ifndef WINDOWS_SYS
|
|
||||||
usleep((int) (timeDelta * 1000000));
|
|
||||||
#else
|
|
||||||
Sleep((int) (timeDelta * 1000));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void rs_nxs_test::NxsTestHub::StartTest()
|
void rs_nxs_test::NxsTestHub::StartTest()
|
||||||
{
|
{
|
||||||
// get all services up and running
|
// get all services up and running
|
||||||
|
@ -138,7 +120,7 @@ void rs_nxs_test::NxsTestHub::StartTest()
|
||||||
void rs_nxs_test::NxsTestHub::EndTest()
|
void rs_nxs_test::NxsTestHub::EndTest()
|
||||||
{
|
{
|
||||||
// then stop this thread
|
// then stop this thread
|
||||||
ask_for_stop();
|
join();
|
||||||
|
|
||||||
// stop services
|
// stop services
|
||||||
PeerNxsMap::iterator mit = mPeerNxsMap.begin();
|
PeerNxsMap::iterator mit = mPeerNxsMap.begin();
|
||||||
|
@ -217,7 +199,7 @@ void rs_nxs_test::NxsTestHub::CleanUpTest()
|
||||||
mTestScenario->cleanTestScenario();
|
mTestScenario->cleanTestScenario();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rs_nxs_test::NxsTestHub::tick()
|
void rs_nxs_test::NxsTestHub::data_tick()
|
||||||
{
|
{
|
||||||
// for each nxs instance pull out all items from each and then move to destination peer
|
// for each nxs instance pull out all items from each and then move to destination peer
|
||||||
|
|
||||||
|
@ -248,6 +230,8 @@ void rs_nxs_test::NxsTestHub::tick()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double timeDelta = .2;
|
||||||
|
usleep(timeDelta * 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace rs_nxs_test
|
||||||
* and synchronise according to their subscriptions. The default is to subscribe to all groups held by other peer
|
* and synchronise according to their subscriptions. The default is to subscribe to all groups held by other peer
|
||||||
* The threads for both net instances are started which begins their processing of transactions
|
* The threads for both net instances are started which begins their processing of transactions
|
||||||
*/
|
*/
|
||||||
class NxsTestHub : public RsThread, public RecvPeerItemIface
|
class NxsTestHub : public RsTickingThread, public RecvPeerItemIface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -58,12 +58,6 @@ namespace rs_nxs_test
|
||||||
*/
|
*/
|
||||||
bool testsPassed();
|
bool testsPassed();
|
||||||
|
|
||||||
/*!
|
|
||||||
* This simulates the p3Service ticker and calls both gxs net services tick methods
|
|
||||||
* Also enables transport of messages between both services
|
|
||||||
*/
|
|
||||||
void runloop();
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Begings test, equivalent to CreateThread(this)
|
* Begings test, equivalent to CreateThread(this)
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +91,11 @@ namespace rs_nxs_test
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void tick();
|
/*!
|
||||||
|
* This simulates the p3Service ticker and calls both gxs net services tick methods
|
||||||
|
* Also enables transport of messages between both services
|
||||||
|
*/
|
||||||
|
virtual void data_tick();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue