Skip to content

Commit

Permalink
Fix build and linters
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
  • Loading branch information
ahcorde committed Dec 4, 2024
1 parent 26ce44f commit 4982ae2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <algorithm>
#include <array>
#include <functional>
#include <memory>
#include <mutex>
Expand Down
60 changes: 30 additions & 30 deletions rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ class rmw_context_impl_s::Data final
}

// Check if shm is enabled.
z_owned_string_t shm_enabled;
zc_config_get_from_str(z_loan(config), Z_CONFIG_SHARED_MEMORY_KEY, &shm_enabled);
auto always_free_shm_enabled = rcpputils::make_scope_exit(
[&shm_enabled]() {
z_drop(z_move(shm_enabled));
});
// z_owned_string_t shm_enabled;
// zc_config_get_from_str(z_loan(config), Z_CONFIG_SHARED_MEMORY_KEY, &shm_enabled);
// auto always_free_shm_enabled = rcpputils::make_scope_exit(
// [&shm_enabled]() {
// z_drop(z_move(shm_enabled));
// });

// Initialize the zenoh session.
if (z_open(&session_, z_move(config), NULL) != Z_OK) {
Expand Down Expand Up @@ -166,29 +166,29 @@ class rmw_context_impl_s::Data final

// Initialize the shm manager if shared_memory is enabled in the config.
shm_provider_ = std::nullopt;
if (strncmp(
z_string_data(z_loan(shm_enabled)),
"true",
z_string_len(z_loan(shm_enabled))) == 0)
{
// TODO(yuyuan): determine the default alignment of SHM
z_alloc_alignment_t alignment = {5};
z_owned_memory_layout_t layout;
z_memory_layout_new(&layout, SHM_BUFFER_SIZE_MB * 1024 * 1024, alignment);

z_owned_shm_provider_t provider;
if (z_posix_shm_provider_new(&provider, z_loan(layout)) != Z_OK) {
RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create an SHM provider.");
throw std::runtime_error("Unable to create an SHM provider.");
}
shm_provider_ = provider;
}
auto free_shm_provider = rcpputils::make_scope_exit(
[this]() {
if (shm_provider_.has_value()) {
z_drop(z_move(shm_provider_.value()));
}
});
// if (strncmp(
// z_string_data(z_loan(shm_enabled)),
// "true",
// z_string_len(z_loan(shm_enabled))) == 0)
// {
// // TODO(yuyuan): determine the default alignment of SHM
// z_alloc_alignment_t alignment = {5};
// z_owned_memory_layout_t layout;
// z_memory_layout_new(&layout, SHM_BUFFER_SIZE_MB * 1024 * 1024, alignment);

// z_owned_shm_provider_t provider;
// if (z_posix_shm_provider_new(&provider, z_loan(layout)) != Z_OK) {
// RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create an SHM provider.");
// throw std::runtime_error("Unable to create an SHM provider.");
// }
// shm_provider_ = provider;
// }
// auto free_shm_provider = rcpputils::make_scope_exit(
// [this]() {
// if (shm_provider_.has_value()) {
// z_drop(z_move(shm_provider_.value()));
// }
// });

graph_guard_condition_ = std::make_unique<rmw_guard_condition_t>();
graph_guard_condition_->implementation_identifier = rmw_zenoh_cpp::rmw_zenoh_identifier;
Expand Down Expand Up @@ -216,7 +216,7 @@ class rmw_context_impl_s::Data final
}

close_session.cancel();
free_shm_provider.cancel();
// free_shm_provider.cancel();
undeclare_z_sub.cancel();
}

Expand Down
1 change: 0 additions & 1 deletion rmw_zenoh_cpp/src/rmw_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "rmw/init_options.h"

#include "rcpputils/scope_exit.hpp"
#include "rcutils/env.h"

extern "C"
{
Expand Down

0 comments on commit 4982ae2

Please sign in to comment.