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 31, 2024
1 parent c9af4ef commit 63ac6f6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 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-31 20:22:20+00:00 - build 6388

1. Continue 6385.5.

--------------------------------------------------------------------------------
drkns 2024-10-29 18:54:27+00:00 - build 6387

Expand Down
28 changes: 15 additions & 13 deletions far/filesystemwatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,22 @@ class background_watcher: public singleton<background_watcher>
public:
void add(FileSystemWatcher* Client)
{
SCOPED_ACTION(std::scoped_lock)(m_CS);
{
SCOPED_ACTION(std::scoped_lock)(m_CS);

m_Clients.emplace_back(Client);
m_Clients.emplace_back(Client);

m_Synchronised.reset();
m_Synchronised.reset();
m_Update.set();

if (!m_Thread.joinable() || m_Thread.is_signaled())
m_Thread = os::thread(&background_watcher::process, this);
if (!m_Thread.joinable() || m_Thread.is_signaled())
{
LOGINFO(L"MAKING THREAD"sv);
m_Thread = os::thread(&background_watcher::process, this);
}
}

m_Update.set();
m_Synchronised.wait();
}

void remove(const FileSystemWatcher* Client)
Expand Down Expand Up @@ -109,12 +115,6 @@ class background_watcher: public singleton<background_watcher>
{
SCOPE_EXIT{ m_Synchronised.set(); };

if (m_Clients.empty())
{
LOGDEBUG(L"FS Watcher exit"sv);
return;
}

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

}
}

Expand All @@ -135,7 +134,10 @@ class background_watcher: public singleton<background_watcher>
if (Result == 0)
{
if (m_Exit)
{
LOGDEBUG(L"FS Watcher exit"sv);
return;
}

continue;
}
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6387
6388

0 comments on commit 63ac6f6

Please sign in to comment.