| 419 | |
| 420 | |
| 421 | void Avida::Data::Manager::PerformUpdate(Context&, Update current_update) |
| 422 | { |
| 423 | m_current_value_mutex.Lock(); |
| 424 | m_current_values.Clear(); |
| 425 | m_current_value_mutex.Unlock(); |
| 426 | |
| 427 | m_rwlock.ReadLock(); |
| 428 | |
| 429 | // Update all of the active providers |
| 430 | for (int i = 0; i < m_active_providers.GetSize(); i++) m_active_providers[i]->UpdateProvidedValues(current_update); |
| 431 | |
| 432 | // Notify recorders that new data is available |
| 433 | DataRetrievalFunctor drf(this, &Manager::GetCurrentValue); |
| 434 | |
| 435 | // Lock recorder mutex before releasing RWLock, so that only recorders that have values will be notified |
| 436 | m_recorder_mutex.Lock(); |
| 437 | |
| 438 | // Release RWLock before notification to prevent double RWLocking deadlock during recorder attachment |
| 439 | m_rwlock.ReadUnlock(); |
| 440 | |
| 441 | for (Apto::Set<RecorderPtr>::Iterator it = m_recorders.Begin(); it.Next();) { |
| 442 | (*it.Get())->NotifyData(current_update, drf); |
| 443 | } |
| 444 | m_recorder_mutex.Unlock(); |
| 445 | } |
| 446 | |
| 447 | Avida::Data::PackagePtr Avida::Data::Manager::GetCurrentValue(const DataID& data_id) const |
| 448 | { |
nothing calls this directly
no test coverage detected