Skip to content

Commit

Permalink
Continue 6385.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Oct 29, 2024
1 parent fe4898b commit c9af4ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
drkns 2024-10-29 18:54:27+00:00 - build 6387

1. Continue 6385.5.

--------------------------------------------------------------------------------
drkns 2024-10-29 02:35:48+00:00 - build 6386

Expand Down
13 changes: 7 additions & 6 deletions far/filesystemwatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class background_watcher: public singleton<background_watcher>
IMPLEMENTS_SINGLETON;

public:
void add(const FileSystemWatcher* Client)
void add(FileSystemWatcher* Client)
{
SCOPED_ACTION(std::scoped_lock)(m_CS);

Expand Down Expand Up @@ -117,7 +117,7 @@ class background_watcher: public singleton<background_watcher>

auto PendingHandleCopy = std::exchange(PendingHandle, {});
Handles.resize(1);
std::ranges::transform(m_Clients, std::back_inserter(Handles), [&](const FileSystemWatcher* const Client)
std::ranges::transform(m_Clients, std::back_inserter(Handles), [&](FileSystemWatcher* const Client)
{
const auto Handle = Client->m_Event.native_handle();
if (Handle == PendingHandleCopy)
Expand Down Expand Up @@ -151,7 +151,7 @@ class background_watcher: public singleton<background_watcher>

m_Clients[Result - 1]->callback_notify();

for (const auto& Client: m_Clients)
for (auto& Client: m_Clients)
{
if (Client != m_Clients[Result - 1] && Client->m_Event.is_signaled())
Client->callback_notify();
Expand All @@ -173,7 +173,7 @@ class background_watcher: public singleton<background_watcher>
os::critical_section m_CS;
os::event m_Update{ os::event::type::automatic, os::event::state::nonsignaled };
os::event m_Synchronised{ os::event::type::manual, os::event::state::nonsignaled };
std::vector<const FileSystemWatcher*> m_Clients;
std::vector<FileSystemWatcher*> m_Clients;
std::atomic_bool m_Exit{};
os::thread m_Thread;
};
Expand Down Expand Up @@ -248,7 +248,7 @@ FileSystemWatcher::~FileSystemWatcher()
}
}

void FileSystemWatcher::read_async() const
void FileSystemWatcher::read_async()
{
m_Event.reset();

Expand All @@ -271,6 +271,7 @@ void FileSystemWatcher::read_async() const
))
{
LOGERROR(L"ReadDirectoryChangesW({}): {}"sv, m_Directory, os::last_error());
m_DirectoryHandle = {};
}
}

Expand All @@ -297,7 +298,7 @@ bool FileSystemWatcher::get_result() const
}
}

void FileSystemWatcher::callback_notify() const
void FileSystemWatcher::callback_notify()
{
if (!m_DirectoryHandle)
return;
Expand Down
4 changes: 2 additions & 2 deletions far/filesystemwatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class FileSystemWatcher
private:
friend class background_watcher;

void read_async() const;
void read_async();
bool get_result() const;
void callback_notify() const;
void callback_notify();

string m_EventId;
string m_Directory;
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6386
6387

0 comments on commit c9af4ef

Please sign in to comment.