| 1831 | } |
| 1832 | |
| 1833 | DDS::InstanceHandle_t DomainParticipantImpl::assign_handle(const GUID_t& id) |
| 1834 | { |
| 1835 | ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, handle_protector_, DDS::HANDLE_NIL); |
| 1836 | if (id == GUID_UNKNOWN) { |
| 1837 | const DDS::InstanceHandle_t ih = |
| 1838 | reusable_handles_.empty() ? participant_handles_.next() : reusable_handles_.pop_front(); |
| 1839 | if (DCPS_debug_level > 5) { |
| 1840 | ACE_DEBUG((LM_DEBUG, "(%P|%t) DomainParticipantImpl::assign_handle: " |
| 1841 | "New unmapped InstanceHandle %d\n", ih)); |
| 1842 | } |
| 1843 | return ih; |
| 1844 | } |
| 1845 | |
| 1846 | const CountedHandleMap::iterator location = handles_.find(id); |
| 1847 | if (location == handles_.end()) { |
| 1848 | const DDS::InstanceHandle_t handle = |
| 1849 | reusable_handles_.empty() ? participant_handles_.next() : reusable_handles_.pop_front(); |
| 1850 | if (DCPS_debug_level > 5) { |
| 1851 | ACE_DEBUG((LM_DEBUG, "(%P|%t) DomainParticipantImpl::assign_handle: " |
| 1852 | "New mapped InstanceHandle %d for %C\n", |
| 1853 | handle, LogGuid(id).c_str())); |
| 1854 | } |
| 1855 | handles_[id] = std::make_pair(handle, 1); |
| 1856 | repoIds_[handle] = id; |
| 1857 | handle_waiters_.notify_all(); |
| 1858 | return handle; |
| 1859 | } |
| 1860 | |
| 1861 | HandleWithCounter& mapped = location->second; |
| 1862 | ++mapped.second; |
| 1863 | if (DCPS_debug_level > 5) { |
| 1864 | ACE_DEBUG((LM_DEBUG, "(%P|%t) DomainParticipantImpl::assign_handle: " |
| 1865 | "Incremented refcount for InstanceHandle %d to %d\n", |
| 1866 | mapped.first, mapped.second)); |
| 1867 | } |
| 1868 | return mapped.first; |
| 1869 | } |
| 1870 | |
| 1871 | DDS::InstanceHandle_t DomainParticipantImpl::await_handle(const GUID_t& id, |
| 1872 | TimeDuration max_wait) const |
no test coverage detected