From 204457506732bd37aa83bde2d7d2aae930add3b3 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Mar 2015 20:53:32 +0000 Subject: [PATCH] attempt to fix never ending thread. To be tested. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7982 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/pqithreadstreamer.cc | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libretroshare/src/pqi/pqithreadstreamer.cc b/libretroshare/src/pqi/pqithreadstreamer.cc index a1ee8b506..8f77338c4 100644 --- a/libretroshare/src/pqi/pqithreadstreamer.cc +++ b/libretroshare/src/pqi/pqithreadstreamer.cc @@ -88,7 +88,7 @@ void pqithreadstreamer::run() void pqithreadstreamer::stop() { -// RsStackMutex stack(mThreadMutex); + //RsStackMutex stack(mThreadMutex); std::cerr << "pqithreadstream::stop()"; std::cerr << std::endl; @@ -98,17 +98,20 @@ void pqithreadstreamer::stop() void pqithreadstreamer::fullstop() { - stop(); - while(1) - { - RsStackMutex stack(mThreadMutex); - if (!mRunning) - { - std::cerr << "pqithreadstream::fullstop() complete"; - std::cerr << std::endl; - return; - } + { + { + RsStackMutex stack(mThreadMutex); + + mToRun = false ; + + if (!mRunning) + { + std::cerr << "pqithreadstream::fullstop() complete"; + std::cerr << std::endl; + return; + } + } usleep(1000); } }