title: How to test multi-threaded in google test?
body: <p>The following testcode creates a server- and a clientsocket. Then client sends a message to server and server replies. Thats all. But I can't compile. All <code>ASSERT_EQ</code> in the threadfunctions raise the error <code>"error: void value not ignored as it ought to be"</code>. I have no clue what this should tell me. What is the problem in here? Type is irrelevant as <code>ASSERT_EQ(1, 1);</code> raises the errors too.</p>
  
  <p><strong>EDIT</strong> Found this in FAQ from google:</p>
  
  <p>Q:My compiler complains "void value not ignored as it ought to be." What does this mean?</p>
  
  <p>A: You're probably using an ASSERT_XY() in a function that doesn't return void. ASSERT_XY() can only be used in void functions.</p>
  
  <p>How shall I understand this?</p>
  
  <pre><code>void * serverfunc(void * ptr);  
  void * clientfunc(void * ptr);    
  
  TEST(netTest, insert)
  {
    pthread_t mThreadID1, mThreadID2;
    ::pthread_create(&amp;mThreadID1, nullptr, serverfunc, nullptr);
    ::sleep(1);
    ::pthread_create(&amp;mThreadID1, nullptr, clientfunc, nullptr);
    ::pthread_join(mThreadID1, nullptr);
    ::pthread_join(mThreadID2, nullptr);        
  }
  
  void * serverfunc(void * ptr)
  {
    net::ServerSocket serv(IPV4, TCP, 55555,5);
    net::ServerSocket * conn = serv.accept();
    net::Message msg;
  
    conn-&gt;recvmsg(&amp;msg);
  
    ASSERT_EQ(msg.size(),5);
    ASSERT_EQ(msg[0],1);
    ASSERT_EQ(msg[1],2);
    ASSERT_EQ(msg[2],3);
    ASSERT_EQ(msg[3],4);
    ASSERT_EQ(msg[4],5);
  
    msg = {9,8,6};
    ASSERT_EQ(msg.size(),3);
    ASSERT_EQ(msg[0],9);
    ASSERT_EQ(msg[1],8);
    ASSERT_EQ(msg[2],6);
  
    conn-&gt;sendmsg(msg);
  
    ::sleep(1);
  
    delete conn;
    return 0;
  }
  
  void * clientfunc(void * ptr)
  {
    net::ClientSocket clie(IPV4, TCP, "localhost",55555);
    net::Message msg;
  
    msg = {1,2,3,4,5};
    ASSERT_EQ(msg.size(),5);
    ASSERT_EQ(msg[0],1);
    ASSERT_EQ(msg[1],2);
    ASSERT_EQ(msg[2],3);
    ASSERT_EQ(msg[3],4);
    ASSERT_EQ(msg[4],5);
  
    clie.sendmsg(msg);
  
    clie.recvmsg(&amp;msg);
  
    ASSERT_EQ(msg.size(),3);
    ASSERT_EQ(msg[0],9);
    ASSERT_EQ(msg[1],8);
    ASSERT_EQ(msg[2],6);
  
    return 0;
  }
  </code></pre>