Selectively move over changes from "edge" to "dev" excluding netcon.

This commit is contained in:
Adam Ierymenko 2015-12-21 16:15:39 -08:00
parent a4cfe4cd16
commit 436c1fac1d
27 changed files with 269 additions and 267 deletions

View file

@ -37,6 +37,7 @@ DeferredPackets::DeferredPackets(const RuntimeEnvironment *renv) :
RR(renv),
_readPtr(0),
_writePtr(0),
_waiting(0),
_die(false)
{
}
@ -45,8 +46,11 @@ DeferredPackets::~DeferredPackets()
{
_q_m.lock();
_die = true;
_q_m.unlock();
_q_s.post();
while (_waiting > 0) {
_q_m.unlock();
_q_s.post();
_q_m.lock();
}
}
bool DeferredPackets::enqueue(IncomingPacket *pkt)
@ -72,16 +76,16 @@ int DeferredPackets::process()
_q_m.lock();
if (_die) {
_q_m.unlock();
_q_s.post();
return -1;
}
while (_readPtr == _writePtr) {
++_waiting;
_q_m.unlock();
_q_s.wait();
_q_m.lock();
--_waiting;
if (_die) {
_q_m.unlock();
_q_s.post();
return -1;
}
}