Skip to content

Commit

Permalink
Fixed incorrect count of issued packets in SetMaximumPooledEntities().
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielHare committed Jul 30, 2014
1 parent 08f76f8 commit a531813
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions autowiring/ObjectPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,14 @@ class ObjectPool
void SetMaximumPooledEntities(size_t maxPooled) {
m_maxPooled = maxPooled;
for(;;) {
std::unique_ptr<T> prior;
std::lock_guard<std::mutex> lk(*m_monitor);

// Space check:
if(m_objs.size() <= m_maxPooled)
// Managed to get the size down sufficiently, we can continue:
return;

// Removing an entry from the cache, must increase the outstanding count at this point
m_outstanding++;

// Funny syntax needed to ensure destructors run while we aren't holding any locks. The prior
// shared_ptr will be reset after the lock is released, guaranteeing the desired ordering.
prior = std::move(m_objs.back());
// Remove unique pointer
m_objs.pop_back();
}
}
Expand Down

0 comments on commit a531813

Please sign in to comment.