From 7249200ccf8ca61be5b6e5b670da68916ee3dbbb Mon Sep 17 00:00:00 2001 From: Sumanth Nirmal Date: Mon, 7 Mar 2022 17:56:55 -0800 Subject: [PATCH] Update samples from iox_queue to reader history cache in the read/take_impl APIs when SHM is supported and iox_listener is not attached to a specific reader Signed-off-by: Sumanth Nirmal --- src/core/ddsc/src/dds_read.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/ddsc/src/dds_read.c b/src/core/ddsc/src/dds_read.c index ccdfa1a87f..7edfb8222c 100644 --- a/src/core/ddsc/src/dds_read.c +++ b/src/core/ddsc/src/dds_read.c @@ -64,6 +64,14 @@ static dds_return_t dds_read_impl (bool take, dds_entity_t reader_or_condition, thread_state_awake (ts1, &entity->m_domain->gv); +#ifdef DDS_HAS_SHM + // If SHM is supported and if the monitor is not attached + if(rd->m_iox_sub && !rd->m_iox_sub_context.monitor) { + // transfer the samples from iox to rhc in the same thread context + dds_transfer_samples_from_iox_to_rhc(rd); + } +#endif + /* Allocate samples if not provided (assuming all or none provided) */ if (buf[0] == NULL) { @@ -163,6 +171,13 @@ static dds_return_t dds_readcdr_impl (bool take, dds_entity_t reader_or_conditio } thread_state_awake (ts1, &entity->m_domain->gv); +#ifdef DDS_HAS_SHM + // If SHM is supported and if the monitor is not attached + if(rd->m_iox_sub && !rd->m_iox_sub_context.monitor) { + // transfer the samples from iox to rhc in the same thread context + dds_transfer_samples_from_iox_to_rhc(rd); + } +#endif /* read/take resets data available status -- must reset before reading because the actual writing is protected by RHC lock, not by rd->m_entity.m_lock */