Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #22 to branch dashing #30

Merged
merged 3 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions rmw_connextdds_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ function(rtirmw_add_library)
CACHE INTERNAL "")
endif()

if(NOT "${RMW_CONNEXT_WAITSET_MODE}" STREQUAL "")
string(TOUPPER "${RMW_CONNEXT_WAITSET_MODE}" rmw_connext_waitset_mode)
if(rmw_connext_waitset_mode STREQUAL "STD")
list(APPEND private_defines "RMW_CONNEXT_CPP_STD_WAITSETS=1")
endif()
set(RMW_CONNEXT_WAITSET_MODE "${RMW_CONNEXT_WAITSET_MODE}"
CACHE INTERNAL "")
endif()

target_compile_definitions(${_rti_build_NAME} PRIVATE ${private_defines})

# Causes the visibility macros to use dllexport rather than dllimport,
Expand Down Expand Up @@ -136,7 +127,6 @@ set(RMW_CONNEXT_COMMON_SOURCE_CPP
src/common/rmw_graph.cpp
src/common/rmw_event.cpp
src/common/rmw_impl.cpp
src/common/rmw_impl_waitset_dds.cpp
src/common/rmw_impl_waitset_std.cpp
src/common/rmw_info.cpp
src/common/rmw_node.cpp
Expand All @@ -159,7 +149,6 @@ set(RMW_CONNEXT_COMMON_SOURCE_HPP
include/rmw_connextdds/resource_limits.hpp
include/rmw_connextdds/rmw_impl.hpp
include/rmw_connextdds/rmw_api_impl.hpp
include/rmw_connextdds/rmw_waitset_dds.hpp
include/rmw_connextdds/rmw_waitset_std.hpp
include/rmw_connextdds/scope_exit.hpp
include/rmw_connextdds/static_config.hpp
Expand Down
4 changes: 4 additions & 0 deletions rmw_connextdds_common/include/rmw_connextdds/dds_api_ndds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ typedef RMW_Connext_Uint8ArrayPtrSeq RMW_Connext_UntypedSampleSeq;
// the guid with 0's.
#define DDS_SampleIdentity_UNKNOWN DDS_SAMPLEIDENTITY_DEFAULT

// Convenience function to compare the first 12 bytes of the handle
#define DDS_InstanceHandle_compare_prefix(ih_a_, ih_b_) \
memcmp((ih_a_)->keyHash.value, (ih_b_)->keyHash.value, 12)

#endif // RMW_CONNEXTDDS__DDS_API_NDDS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ struct DDS_LifespanQosPolicy;
// the guid with 0's.
#define DDS_SampleIdentity_UNKNOWN DDS_SAMPLE_IDENTITY_UNKNOWN

// Convenience function to compare the first 12 bytes of the handle
#define DDS_InstanceHandle_compare_prefix(ih_a_, ih_b_) \
memcmp((ih_a_)->octet, (ih_b_)->octet, 12)

#endif // RMW_CONNEXTDDS__DDS_API_RTIME_HPP_
15 changes: 6 additions & 9 deletions rmw_connextdds_common/include/rmw_connextdds/rmw_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class RMW_Connext_Subscriber;
class RMW_Connext_Client;
class RMW_Connext_Service;

#include "rmw_connextdds/rmw_waitset_dds.hpp"
#include "rmw_connextdds/rmw_waitset_std.hpp"

/******************************************************************************
Expand Down Expand Up @@ -411,13 +410,13 @@ class RMW_Connext_Subscriber
qos(rmw_qos_profile_t * const qos);

rmw_ret_t
loan_messages();
loan_messages(const bool update_condition = true);

rmw_ret_t
return_messages();

rmw_ret_t
loan_messages_if_needed()
loan_messages_if_needed(const bool update_condition = true)
{
rmw_ret_t rc = RMW_RET_OK;

Expand All @@ -432,16 +431,12 @@ class RMW_Connext_Subscriber
}
}
/* loan messages from reader */
rc = this->loan_messages();
rc = this->loan_messages(update_condition);
if (RMW_RET_OK != rc) {
return rc;
}
}

if (this->internal) {
return this->status_condition.trigger_loan_guard_condition(this->loan_len > 0);
}

return RMW_RET_OK;
}

Expand Down Expand Up @@ -477,7 +472,9 @@ class RMW_Connext_Subscriber
has_data()
{
std::lock_guard<std::mutex> lock(this->loan_mutex);
if (RMW_RET_OK != this->loan_messages_if_needed()) {
if (RMW_RET_OK !=
this->loan_messages_if_needed(false /* update_condition */))
{
RMW_CONNEXT_LOG_ERROR("failed to check loaned messages")
return false;
}
Expand Down
Loading