mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
moved rsGlobalShutDown from MainWindow::doQuit to main
rsGlobalShutDown now cleans the threads and some memory on exit git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3028 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b80aef1228
commit
334c9b61d3
13 changed files with 61 additions and 16 deletions
|
@ -80,8 +80,15 @@ pthread_t createThread(RsThread &thread)
|
|||
|
||||
}
|
||||
|
||||
RsThread::RsThread ()
|
||||
{
|
||||
m_bRun = true;
|
||||
}
|
||||
|
||||
void RsThread::join() /* waits for the the mTid thread to stop */
|
||||
{
|
||||
m_bRun = false;
|
||||
|
||||
void *ptr;
|
||||
pthread_join(mTid, &ptr);
|
||||
}
|
||||
|
@ -100,7 +107,7 @@ RsQueueThread::RsQueueThread(uint32_t min, uint32_t max, double relaxFactor )
|
|||
|
||||
void RsQueueThread::run()
|
||||
{
|
||||
while(1)
|
||||
while(m_bRun)
|
||||
{
|
||||
bool doneWork = false;
|
||||
while(workQueued() && doWork())
|
||||
|
|
|
@ -145,8 +145,8 @@ pthread_t createThread(RsThread &thread);
|
|||
class RsThread
|
||||
{
|
||||
public:
|
||||
RsThread() { return; }
|
||||
virtual ~RsThread() { return; }
|
||||
RsThread();
|
||||
virtual ~RsThread() {}
|
||||
|
||||
virtual void start() { createThread(*this); }
|
||||
virtual void run() = 0; /* called once the thread is started */
|
||||
|
@ -155,6 +155,8 @@ virtual void stop(); /* calls pthread_exit() */
|
|||
|
||||
pthread_t mTid;
|
||||
RsMutex mMutex;
|
||||
protected:
|
||||
bool m_bRun;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue