summaryrefslogtreecommitdiff
path: root/gio/src/application.ccg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2015-11-26 20:36:59 +0100
committerMurray Cumming <murrayc@murrayc.com>2015-11-26 20:52:48 +0100
commit27bef8caaab860803ffdd0cd2214390488ff886b (patch)
treee4a958e6e016343058879ef4d448190bad96ba9f /gio/src/application.ccg
parentc12604569c65ed543822ccfc337d014b45c27345 (diff)
downloadglibmm-27bef8caaab860803ffdd0cd2214390488ff886b.tar.gz
Gio::Application: Use std::mutex instead of Glib::Threads::Mutex.
And std::unique_lock instead of Glib::Threads::Mutex::Lock. Some of these could probably be replaced by std::lock_guard, in a smaller scope, instead of using release(), but this is a simpler replacement.
Diffstat (limited to 'gio/src/application.ccg')
-rw-r--r--gio/src/application.ccg10
1 files changed, 5 insertions, 5 deletions
diff --git a/gio/src/application.ccg b/gio/src/application.ccg
index 9a854a5b..e63aef9b 100644
--- a/gio/src/application.ccg
+++ b/gio/src/application.ccg
@@ -190,7 +190,7 @@ OptionArgCallbackDataMap option_arg_callback_data;
// Gio::Application instances may be used in different threads.
// Accesses to option_arg_callback_data must be thread-safe.
-Glib::Threads::Mutex option_arg_callback_data_mutex;
+std::mutex option_arg_callback_data_mutex;
gboolean Application_option_arg_callback(const gchar* option_name, const gchar* value,
gpointer /* data */, GError** error)
@@ -199,7 +199,7 @@ gboolean Application_option_arg_callback(const gchar* option_name, const gchar*
// option_name is either a single dash followed by a single letter (for a
// short name) or two dashes followed by a long option name.
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::unique_lock<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::const_iterator iterFind = option_arg_callback_data.end();
if (option_name[1] == '-')
{
@@ -284,7 +284,7 @@ Application::Application(const Glib::ustring& application_id, ApplicationFlags f
Application::~Application()
{
// Delete all OptionArgCallbackData instances that belong to this application.
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::lock_guard<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::iterator iter = option_arg_callback_data.begin();
while (iter != option_arg_callback_data.end())
{
@@ -396,7 +396,7 @@ void Application::add_main_option_entry(
gchar short_name, const Glib::ustring& description,
const Glib::ustring& arg_description, int flags)
{
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::unique_lock<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
if (iterFind != option_arg_callback_data.end())
return; // Ignore duplicates
@@ -414,7 +414,7 @@ void Application::add_main_option_entry_filename(
gchar short_name, const Glib::ustring& description,
const Glib::ustring& arg_description, int flags)
{
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::unique_lock<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
if (iterFind != option_arg_callback_data.end())
return; // Ignore duplicates