From e575a3d6fa5ce9dc915c9fed60deb0f3fc2cf0eb Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Mon, 20 Jan 2025 20:12:10 +0000 Subject: [PATCH 1/3] Remove deprecated lock_memory --- include/realtime_tools/realtime_helpers.hpp | 13 ------------- src/realtime_helpers.cpp | 7 ------- 2 files changed, 20 deletions(-) diff --git a/include/realtime_tools/realtime_helpers.hpp b/include/realtime_tools/realtime_helpers.hpp index 3a631976..e1685e82 100644 --- a/include/realtime_tools/realtime_helpers.hpp +++ b/include/realtime_tools/realtime_helpers.hpp @@ -59,19 +59,6 @@ bool has_realtime_kernel(); */ bool configure_sched_fifo(int priority); -/** - * Locks the memory pages of the calling thread to prevent page faults. - * By calling this method, the programs locks all pages mapped into the address - * space of the calling process and future mappings. This means that the kernel - * will not swap out the pages to disk i.e., the pages are guaranteed to stay in - * RAM until later unlocked - which is important for realtime applications. - * \param[out] message a message describing the result of the operation - * \returns true if memory locking succeeded, false otherwise. -*/ - -[[deprecated("Use std::pair lock_memory() instead.")]] -bool lock_memory(std::string & message); - /** * Locks the memory pages of the calling thread to prevent page faults. * By calling this method, the programs locks all pages mapped into the address diff --git a/src/realtime_helpers.cpp b/src/realtime_helpers.cpp index bbabf0bc..f2406362 100644 --- a/src/realtime_helpers.cpp +++ b/src/realtime_helpers.cpp @@ -66,13 +66,6 @@ bool configure_sched_fifo(int priority) #endif } -bool lock_memory(std::string & message) -{ - const auto lock_result = lock_memory(); - message = lock_result.second; - return lock_result.first; -} - std::pair lock_memory() { #ifdef _WIN32 From 1e882b6e91e7763d04283d58cdacd145812ecff5 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Mon, 20 Jan 2025 20:12:20 +0000 Subject: [PATCH 2/3] Remove deprecated header files --- include/realtime_tools/realtime_box.h | 29 ------------- .../realtime_tools/realtime_box_best_effort.h | 29 ------------- include/realtime_tools/realtime_buffer.h | 29 ------------- include/realtime_tools/realtime_publisher.h | 29 ------------- .../realtime_server_goal_handle.h | 29 ------------- include/realtime_tools/thread_priority.hpp | 43 ------------------- 6 files changed, 188 deletions(-) delete mode 100644 include/realtime_tools/realtime_box.h delete mode 100644 include/realtime_tools/realtime_box_best_effort.h delete mode 100644 include/realtime_tools/realtime_buffer.h delete mode 100644 include/realtime_tools/realtime_publisher.h delete mode 100644 include/realtime_tools/realtime_server_goal_handle.h delete mode 100644 include/realtime_tools/thread_priority.hpp diff --git a/include/realtime_tools/realtime_box.h b/include/realtime_tools/realtime_box.h deleted file mode 100644 index 88c7285a..00000000 --- a/include/realtime_tools/realtime_box.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef REALTIME_TOOLS__REALTIME_BOX_H_ -#define REALTIME_TOOLS__REALTIME_BOX_H_ - -#include "realtime_tools/realtime_box.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_box.hpp' header.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_box.hpp' header." //NOLINT -#endif - -#endif // REALTIME_TOOLS__REALTIME_BOX_H_ diff --git a/include/realtime_tools/realtime_box_best_effort.h b/include/realtime_tools/realtime_box_best_effort.h deleted file mode 100644 index 7f8d1cca..00000000 --- a/include/realtime_tools/realtime_box_best_effort.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef REALTIME_TOOLS__REALTIME_BOX_BEST_EFFORT_H_ -#define REALTIME_TOOLS__REALTIME_BOX_BEST_EFFORT_H_ - -#include "realtime_tools/realtime_box.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_box.hpp' header.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_box.hpp' header." //NOLINT -#endif - -#endif // REALTIME_TOOLS__REALTIME_BOX_BEST_EFFORT_H_ diff --git a/include/realtime_tools/realtime_buffer.h b/include/realtime_tools/realtime_buffer.h deleted file mode 100644 index 2a8c7436..00000000 --- a/include/realtime_tools/realtime_buffer.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef REALTIME_TOOLS__REALTIME_BUFFER_H_ -#define REALTIME_TOOLS__REALTIME_BUFFER_H_ - -#include "realtime_tools/realtime_buffer.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_buffer.hpp' header." //NOLINT -#endif - -#endif // REALTIME_TOOLS__REALTIME_BUFFER_H_ diff --git a/include/realtime_tools/realtime_publisher.h b/include/realtime_tools/realtime_publisher.h deleted file mode 100644 index 64dc4f6a..00000000 --- a/include/realtime_tools/realtime_publisher.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef REALTIME_TOOLS__REALTIME_PUBLISHER_H_ -#define REALTIME_TOOLS__REALTIME_PUBLISHER_H_ - -#include "realtime_tools/realtime_publisher.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_publisher.hpp' header.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_publisher.hpp' header." //NOLINT -#endif - -#endif // REALTIME_TOOLS__REALTIME_PUBLISHER_H_ diff --git a/include/realtime_tools/realtime_server_goal_handle.h b/include/realtime_tools/realtime_server_goal_handle.h deleted file mode 100644 index 49a9f77d..00000000 --- a/include/realtime_tools/realtime_server_goal_handle.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef REALTIME_TOOLS__REALTIME_SERVER_GOAL_HANDLE_H_ -#define REALTIME_TOOLS__REALTIME_SERVER_GOAL_HANDLE_H_ - -#include "realtime_tools/realtime_server_goal_handle.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_server_goal_handle.hpp' header.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_server_goal_handle.hpp' header." //NOLINT -#endif - -#endif // REALTIME_TOOLS__REALTIME_SERVER_GOAL_HANDLE_H_ diff --git a/include/realtime_tools/thread_priority.hpp b/include/realtime_tools/thread_priority.hpp deleted file mode 100644 index f61cdf75..00000000 --- a/include/realtime_tools/thread_priority.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2022, PickNik, Inc. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the PickNik Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#ifndef REALTIME_TOOLS__THREAD_PRIORITY_HPP_ -#define REALTIME_TOOLS__THREAD_PRIORITY_HPP_ - -#include "realtime_tools/realtime_helpers.hpp" - -// Deprecation notice -#ifdef _WIN32 -#pragma message( \ - "This header include is deprecated. Please update your code to use 'realtime_helpers.hpp' header and link against 'realtime_tools' library.") //NOLINT -#else -#warning \ - "This header include is deprecated. Please update your code to use 'realtime_helpers.hpp' header and link against 'realtime_tools' library." //NOLINT -#endif - -#endif // REALTIME_TOOLS__THREAD_PRIORITY_HPP_ From a4e39f5af42803dc5293258e6738382440194992 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Mon, 20 Jan 2025 20:15:09 +0000 Subject: [PATCH 3/3] Remove deprecated methods --- include/realtime_tools/realtime_box.hpp | 97 ------------------------- 1 file changed, 97 deletions(-) diff --git a/include/realtime_tools/realtime_box.hpp b/include/realtime_tools/realtime_box.hpp index 5c899f1c..4882e071 100644 --- a/include/realtime_tools/realtime_box.hpp +++ b/include/realtime_tools/realtime_box.hpp @@ -152,37 +152,6 @@ class RealtimeBoxBase return true; } - /** - * @brief set a new content with best effort - * @return false if mutex could not be locked - * @note disabled for pointer types - * @deprecated Use try_set(const T & value) instead! - */ - template - [[deprecated("Use try_set(const T & value) instead!")]] - typename std::enable_if_t, bool> trySet(const T & value) - { - std::unique_lock guard(lock_, std::defer_lock); - if (!guard.try_lock()) { - return false; - } - value_ = value; - return true; - } - - /** - * @brief access the content readable with best effort - * @return false if the mutex could not be locked - * @note only safe way to access pointer type content (rw) - * @deprecated Use try_set(const std::function & func) instead! - */ - template - [[deprecated("Use try_set(const std::function & func) instead!")]] - bool trySet(const std::function & func) - { - return try_set(func); - } - /** * @brief get the content with best effort * @return std::nullopt if content could not be access, otherwise the content is returned @@ -213,31 +182,6 @@ class RealtimeBoxBase return true; } - /** - * @brief get the content with best effort - * @return std::nullopt if content could not be access, otherwise the content is returned - * @deprecated Use try_get() instead! - */ - template - [[deprecated("Use try_get() instead!")]] [[nodiscard]] - typename std::enable_if_t, std::optional> tryGet() const - { - return try_get(); - } - - /** - * @brief access the content (r) with best effort - * @return false if the mutex could not be locked - * @note only safe way to access pointer type content (r) - * @deprecated Use try_get(const std::function & func) instead! - */ - template - [[deprecated("Use try_get(const std::function & func) instead!")]] - bool tryGet(const std::function & func) - { - return try_get(func); - } - /** * @brief Wait until the mutex can be locked and set the content (RealtimeBox behavior) * @note disabled for pointer types @@ -251,21 +195,6 @@ class RealtimeBoxBase value_ = value; } - /** - * @brief Wait until the mutex can be locked and set the content (RealtimeBox behavior) - * @note same signature as in the existing RealtimeBox - * @note Not the safest way to access pointer type content (rw) - * @deprecated Use set(const std::function & func) instead! - */ - template - [[deprecated("Use set(const std::function & func) instead!")]] - typename std::enable_if_t, void> set(const T & value) - { - std::lock_guard guard(lock_); - // cppcheck-suppress missingReturn - value_ = value; - } - /** * @brief wait until the mutex could be locked and access the content (rw) */ @@ -304,21 +233,6 @@ class RealtimeBoxBase in = value_; } - /** - * @brief Wait until the mutex could be locked and get the content (r) - * @note same signature as in the existing RealtimeBox - * @note Not the safest way to access pointer type content (r) - * @deprecated Use get(const std::function & func) instead! - */ - template - [[deprecated("Use get(const std::function & func) instead!")]] - typename std::enable_if_t, void> get(T & in) const - { - std::lock_guard guard(lock_); - // cppcheck-suppress missingReturn - in = value_; - } - /** * @brief Wait until the mutex could be locked and access the content (r) * @note only safe way to access pointer type content (r) @@ -368,12 +282,6 @@ class RealtimeBoxBase [[nodiscard]] const mutex_t & get_mutex() const { return lock_; } [[nodiscard]] mutex_t & get_mutex() { return lock_; } - [[nodiscard]] [[deprecated("Use get_mutex() instead!")]] mutex_t & getMutex() { return lock_; } - [[nodiscard]] [[deprecated("Use get_mutex() instead!")]] const mutex_t & getMutex() const - { - return lock_; - } - private: T value_; @@ -387,11 +295,6 @@ class RealtimeBoxBase // Introduce some easier to use names -// Only kept for compatibility reasons -template -using RealtimeBoxBestEffort [[deprecated("Use RealtimeBox instead")]] = - RealtimeBoxBase; - // Provide specialisations for different mutex types template using RealtimeBoxStandard = RealtimeBoxBase;