Another fix to Network life cycle.

This commit is contained in:
Adam Ierymenko 2014-08-21 18:07:27 -07:00
parent af62a6cade
commit eadff71d37
2 changed files with 9 additions and 2 deletions

View file

@ -64,7 +64,11 @@ const char *Network::statusString(const Status s)
Network::~Network()
{
Thread::join(_setupThread);
_lock.lock();
if ((_setupThread)&&(!_destroyed)) {
_lock.unlock();
Thread::join(_setupThread);
} else _lock.unlock();
{
Mutex::Lock _l(_lock);
@ -414,7 +418,9 @@ void Network::destroy()
_enabled = false;
_destroyed = true;
Thread::join(_setupThread);
if (_setupThread)
Thread::join(_setupThread);
_setupThread = Thread();
if (_tap)
_r->tapFactory->close(_tap,true);