title: c++ linux accept() blocking after socket closed
body: <p>I have a thread that listens for new connections</p>
  
  <pre><code>new_fd = accept(Listen_fd, (struct sockaddr *) &amp; their_addr, &amp;sin_size);
  </code></pre>
  
  <p>and another thread that closes Listen_fd when when it's time to close the program.  After Listen_fd is closed however, it still blocks. When I use GDB to try and debug accept() doesn't block. I thought that it could be a problem with SO_LINGER, but it shouldn't be on by default, and shouldn't change when using GDB. Any idea whats going on, or any other suggestion to closing the listing socket?</p>