Skip to content

Commit

Permalink
Refs #20706: Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed Apr 17, 2024
1 parent a22b420 commit 21efb81
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion include/fastdds/dds/subscriber/DataReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,9 @@ class DataReader : public DomainEntity
const void* instance) const;

/**
* @brief Returns information about the first untaken sample.
* @brief Returns information about the first untaken sample. This method is meant to be called prior to
* a read() or take() operation as it does not modify the status condition of the entity.
*
*
* @param [out] info Pointer to a SampleInfo_t structure to store first untaken sample information.
*
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/fastdds/subscriber/DataReaderImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ class DataReaderImpl
SampleInfoSeq& sample_infos);

/**
* @brief Returns information about the first untaken sample.
* @brief Returns information about the first untaken sample. This method is meant to be called prior to
* a read() or take() operation as it does not modify the status condition of the entity.
* @param [out] info Pointer to a SampleInfo structure to store first untaken sample information.
* @return true if sample info was returned. false if there is no sample to take.
*/
Expand Down
15 changes: 13 additions & 2 deletions src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,20 @@ bool DataReaderHistory::get_first_untaken_info(
for (auto& it : data_available_instances_)
{
auto& instance_changes = it.second->cache_changes;
if (!instance_changes.empty())
for (auto& instance_change : instance_changes)
{
ReadTakeCommand::generate_info(info, *(it.second), instance_changes.front());
WriterProxy* wp;
bool is_future_change = false;

{
std::lock_guard<RecursiveTimedMutex> _(mp_reader->getMutex());
if (mp_reader->begin_sample_access_nts(instance_change, wp, is_future_change) && is_future_change)
{
continue;
}
}

ReadTakeCommand::generate_info(info, *(it.second), instance_change);
return true;
}
}
Expand Down

0 comments on commit 21efb81

Please sign in to comment.