Browse Source

locking improvements

cl-refactor
arkpar 10 years ago
parent
commit
050ee239fd
  1. 11
      libethereum/TransactionQueue.cpp

11
libethereum/TransactionQueue.cpp

@ -361,10 +361,12 @@ void TransactionQueue::clear()
void TransactionQueue::enqueue(RLP const& _data, h512 const& _nodeId) void TransactionQueue::enqueue(RLP const& _data, h512 const& _nodeId)
{ {
unique_lock<Mutex> l(x_queue); {
unsigned itemCount = _data.itemCount(); Guard l(x_queue);
for (unsigned i = 0; i < itemCount; ++i) unsigned itemCount = _data.itemCount();
m_unverified.emplace_back(UnverifiedTransaction(_data[i].data(), _nodeId)); for (unsigned i = 0; i < itemCount; ++i)
m_unverified.emplace_back(UnverifiedTransaction(_data[i].data(), _nodeId));
}
m_queueReady.notify_all(); m_queueReady.notify_all();
} }
@ -385,7 +387,6 @@ void TransactionQueue::verifierBody()
try try
{ {
Transaction t(work.transaction, CheckTransaction::Cheap); //Signature will be checked later Transaction t(work.transaction, CheckTransaction::Cheap); //Signature will be checked later
ImportResult ir = import(t); ImportResult ir = import(t);
m_onImport(ir, t.sha3(), work.nodeId); m_onImport(ir, t.sha3(), work.nodeId);

Loading…
Cancel
Save