BugFix: Exclusive control the close of TCPIP

This commit is contained in:
tomoaki
2016-07-23 05:56:55 +09:00
parent 5605ae0294
commit 464187a08b
4 changed files with 12 additions and 4 deletions

View File

@@ -57,6 +57,7 @@ bool TCPStack::isValid()
void TCPStack::close()
{
_mutex.lock();
if (_sockfd > 0)
{
::close(_sockfd);
@@ -67,6 +68,7 @@ void TCPStack::close()
_addrinfo = 0;
}
}
_mutex.unlock();
}

View File

@@ -59,6 +59,7 @@ public:
private:
int _sockfd;
addrinfo* _addrinfo;
Mutex _mutex;
};
/*========================================