Getting error when using pthread_create
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1151582/pthread-function-from-a-class">pthread Function from a Class</a>  </p>
</blockquote>



<p>I am fairly new to c++ and I am doing a project regarding TCP.</p>

<p>I need to create a thread so I googled and found this.
<a href="http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html" rel="nofollow">http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html</a></p>

<p>I follow its syntax but encounter errors:
 argument of type ‘void* (ns3::TcpSocketBase::)()’ does not match ‘void* (<em>)(void</em>)’</p>

<p>codes:</p>

<pre><code>tcp-socket-base.h:
class TcpSocketBase : public TcpSocket
{
 public:
 ...
 void *threadfunction();
 ....
}




tcp-socket-base.cc:

void
*TcpSocketBase::threadfunction()
{
//do something
}



..//the thread was create and the function is called here
pthread_t t1;
int temp  =  pthread_create(&amp;t1, NULL, ReceivedSpecialAck, NULL); //The error happens here
return;
...
</code></pre>

<p>Any help would be appreciated. Thanks!</p>

<p>EDIT:</p>

<p>I took the advise and make the threadfunction a non member function.</p>

<pre><code>namespaceXXX{

void *threadfunction()


int result  =  pthread_create(&amp;t1, NULL, threadfunction, NULL);
      NS_LOG_LOGIC ("TcpSocketBase " &lt;&lt; this &lt;&lt; " Create Thread returned result: " &lt;&lt; result );

void *threadfunction()
{
 .....
}


}
</code></pre>

<p>But I got this error instead:</p>

<p>initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (<em>)(void</em>), void*)’  [-fpermissive]</p>
