[gnote] Replace Glib mutex with std in note dir watcher
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Replace Glib mutex with std in note dir watcher
- Date: Mon, 3 May 2021 20:11:48 +0000 (UTC)
commit de668373ce0a1338e6fbcaaaac9fc114eb0d178d
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon May 3 23:09:33 2021 +0300
Replace Glib mutex with std in note dir watcher
.../notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp | 5 ++---
.../notedirectorywatcher/notedirectorywatcherapplicationaddin.hpp | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
index 6191827a..93fd5bf5 100644
--- a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
+++ b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2014,2017,2020 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017,2021 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -107,8 +107,8 @@ void NoteDirectoryWatcherApplicationAddin::handle_file_system_change_event(
// Record that the file has been added/changed/deleted. Adds/changes trump
// deletes. Record the date.
- m_lock.lock();
try {
+ std::lock_guard<std::mutex> lock(m_lock);
auto record = m_file_change_records.find(note_id);
if(record == m_file_change_records.end()) {
m_file_change_records[note_id] = NoteFileChangeRecord();
@@ -137,7 +137,6 @@ void NoteDirectoryWatcherApplicationAddin::handle_file_system_change_event(
}
catch(...)
{}
- m_lock.unlock();
Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create(m_check_interval * 1000);
timeout->connect(sigc::mem_fun(*this, &NoteDirectoryWatcherApplicationAddin::handle_timeout));
diff --git a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.hpp
b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.hpp
index 7d024de9..45d2312e 100644
--- a/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.hpp
+++ b/src/plugins/notedirectorywatcher/notedirectorywatcherapplicationaddin.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2014,2017,2019-2020 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017,2019-2021 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -87,7 +87,7 @@ private:
sigc::connection m_signal_settings_changed_cid;
bool m_initialized;
int m_check_interval;
- Glib::Threads::Mutex m_lock;
+ std::mutex m_lock;
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]