[reSIProcate] The ThreadIf bug?

Scott Godin slgodin at icescape.com
Mon Jan 28 08:34:13 CST 2008


Calling detach without ever having called run is a bit odd - but it's
still a good idea to initialize this member - I'll commit a fix to SVN.
Thanks.

 

From: resiprocate-devel-bounces at resiprocate.org
[mailto:resiprocate-devel-bounces at resiprocate.org] On Behalf Of Karlsson
Sent: Saturday, January 26, 2008 8:06 AM
To: resiprocate-devel at list.resiprocate.org
Subject: Re: [reSIProcate] The ThreadIf bug?

 

I think the Thread::ThreadIf() should be:

ThreadIf::ThreadIf() : mId(0), mShutdown(false), mShutdownMutex(),
mThread(NULL)
{


}
 

Thanks 

 

2008/1/26, Karlsson <boost.regex at gmail.com>: 

I saw the ThreadIf  in reSIProcate 1.2.2,

 

ThreadIf::ThreadIf() : mId(0), mShutdown(false), mShutdownMutex()
{
}
 

 

There do not  initialize the mThread, so if in this case will get
application crash:

 

#include <WinSock2.h>
#include <Windows.h>
#include <string>
using namespace std;

#include <rutil/threadif.hxx>
using namespace resip;

#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "../lib/rutilD.lib")

 

class MyThread : public ThreadIf
{
public:
 virtual void thread()
 {
  cout << "MyThread::thead()" << endl;
 }
};

class Test
{
public:

 void release()
 {
  mMyThread.detach();
 }

protected:

private:

 MyThread mMyThread;
};

 

int main()
{
 Test t;

  t.release();

 return 0;
}

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20080128/0bde9722/attachment.htm>


More information about the resiprocate-devel mailing list