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);

View File

@ -262,6 +262,7 @@ static inline void _intl_freeifmaddrs(struct _intl_ifmaddrs *ifmp)
#include "../node/Constants.hpp"
#include "../node/Utils.hpp"
#include "../node/Mutex.hpp"
#include "OSXEthernetTap.hpp"
// ff:ff:ff:ff:ff:ff with no ADI