MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / process_deadlines

Method process_deadlines

dds/DCPS/WriteDataContainer.cpp:1653–1708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1651}
1652
1653void
1654WriteDataContainer::process_deadlines(const MonotonicTimePoint& now)
1655{
1656 // Lock the DataWriterImpl.
1657 ACE_GUARD (ACE_Recursive_Thread_Mutex, dwi_guard, deadline_status_lock_);
1658 // Lock ourselves.
1659 ACE_GUARD (ACE_Recursive_Thread_Mutex, wdc_guard, lock_);
1660
1661 if (deadline_map_.empty()) {
1662 return;
1663 }
1664
1665 bool notify = false;
1666
1667 for (DeadlineMapType::iterator pos = deadline_map_.begin(), limit = deadline_map_.end();
1668 pos != limit && pos->first < now; pos = deadline_map_.begin()) {
1669
1670 PublicationInstance_rch instance = pos->second;
1671 deadline_map_.erase(pos);
1672
1673 ++deadline_status_.total_count;
1674 deadline_status_.total_count_change = deadline_status_.total_count - deadline_last_total_count_;
1675 deadline_status_.last_instance_handle = instance->instance_handle_;
1676
1677 writer_->set_status_changed_flag(DDS::OFFERED_DEADLINE_MISSED_STATUS, true);
1678 notify = true;
1679
1680 DDS::DataWriterListener_var listener = writer_->listener_for(DDS::OFFERED_DEADLINE_MISSED_STATUS);
1681
1682 if (listener) {
1683 // Copy before releasing the lock.
1684 const DDS::OfferedDeadlineMissedStatus status = deadline_status_;
1685
1686 // Release the lock during the upcall.
1687 ACE_Reverse_Lock<ACE_Recursive_Thread_Mutex> deadline_reverse_status_lock(deadline_status_lock_);
1688 ACE_GUARD(ACE_Reverse_Lock<ACE_Recursive_Thread_Mutex>, rev_dwi_guard, deadline_reverse_status_lock);
1689
1690 // @todo Will this operation ever throw? If so we may want to
1691 // catch all exceptions, and act accordingly.
1692 listener->on_offered_deadline_missed(writer_, status);
1693
1694 // We need to update the last total count value to our current total
1695 // so that the next time we will calculate the correct total_count_change;
1696 deadline_last_total_count_ = deadline_status_.total_count;
1697 }
1698
1699 instance->deadline_ += deadline_period_;
1700 deadline_map_.insert(std::make_pair(instance->deadline_, instance));
1701 }
1702
1703 if (notify) {
1704 writer_->notify_status_condition();
1705 }
1706
1707 deadline_task_->schedule(deadline_map_.begin()->first - now);
1708}
1709
1710void

Callers

nothing calls this directly

Calls 10

emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
listener_forMethod · 0.45
insertMethod · 0.45
scheduleMethod · 0.45

Tested by

no test coverage detected