Skip to content

Commit 5226e16

Browse files
committed
[#24574] Disable file watching on macOS and remove invalid InternalPtrData move
Signed-off-by: macmini <macmini@macminis-Mac-mini.local>
1 parent 121bab1 commit 5226e16

4 files changed

Lines changed: 42 additions & 11 deletions

File tree

cpp_utils/include/cpp_utils/memory/impl/InternalPtrData.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class InternalPtrData
5555
//! Create an empty (non valid) data
5656
InternalPtrData() noexcept;
5757

58-
//! Move constructor
58+
//! Move constructor is disabled because the internal mutex is not movable
5959
InternalPtrData(
60-
InternalPtrData&& other) noexcept;
60+
InternalPtrData&& other) noexcept = delete;
6161

6262
/**
6363
* @brief Destruct object

cpp_utils/include/cpp_utils/memory/impl/InternalPtrData.ipp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ InternalPtrData<T>::InternalPtrData() noexcept
3434
{
3535
}
3636

37-
template<typename T>
38-
InternalPtrData<T>::InternalPtrData(
39-
InternalPtrData&& other) noexcept
40-
: reference_(std::move(other.reference_))
41-
, shared_mutex_(std::move(other.shared_mutex_))
42-
, deleter_(std::move(other.deleter_))
43-
{
44-
}
45-
4637
template<typename T>
4738
InternalPtrData<T>::~InternalPtrData() noexcept
4839
{

cpp_utils/src/cpp/event/FileWatcher.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,51 @@
1818

1919
#pragma once
2020

21+
#include <string>
22+
23+
#if !defined(__APPLE__)
2124
#include <FileWatch.hpp>
25+
#endif
2226

2327
namespace eprosima {
2428
namespace utils {
2529
namespace event {
2630

31+
#if defined(__APPLE__)
32+
33+
enum class FileWatchEvent
34+
{
35+
added,
36+
removed,
37+
modified,
38+
renamed_old,
39+
renamed_new
40+
};
41+
42+
class FileWatcher
43+
{
44+
public:
45+
46+
template <typename Callback>
47+
FileWatcher(
48+
std::string,
49+
Callback&&)
50+
{
51+
}
52+
};
53+
54+
#else
55+
2756
class FileWatcher : public filewatch::FileWatch<std::string>
2857
{
2958
using filewatch::FileWatch<std::string>::FileWatch;
3059
};
3160

3261
using FileWatchEvent = filewatch::Event;
3362

63+
#endif // defined(__APPLE__)
64+
3465
} /* namespace event */
3566
} /* namespace utils */
3667
} /* namespace eprosima */
68+

cpp_utils/src/cpp/event/FileWatcherHandler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ void FileWatcherHandler::start_filewatcher_nts_()
5656
{
5757
logInfo(UTILS_FILEWATCHER, "Starting FileWatcher in file: " << file_path_);
5858

59+
#if defined(__APPLE__)
60+
logWarning(
61+
UTILS_FILEWATCHER,
62+
"File watching is disabled on macOS because the bundled backend only supports Windows and Linux.");
63+
filewatcher_started_.store(true);
64+
#else
5965
try
6066
{
6167
file_watch_handler_ = std::make_unique<FileWatcher>(
@@ -81,6 +87,7 @@ void FileWatcherHandler::start_filewatcher_nts_()
8187
}
8288

8389
filewatcher_started_.store(true);
90+
#endif // defined(__APPLE__)
8491

8592
logInfo(UTILS_FILEWATCHER, "Start Watching file: " << file_path_);
8693
}
@@ -112,3 +119,4 @@ void FileWatcherHandler::callback_unset_nts_() noexcept
112119
} /* namespace event */
113120
} /* namespace utils */
114121
} /* namespace eprosima */
122+

0 commit comments

Comments
 (0)