aboutsummaryrefslogtreecommitdiff
path: root/paludis/environments/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-05-16 20:03:48 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-05-22 23:19:18 +0100
commit78d9a9bf0758140e0e8c03c5e8d3288f74efbb51 (patch)
tree1c0b25ba6358e80d0fe535fb49e3cce8d243e6a3 /paludis/environments/paludis
parent39834ca3b05fadb14f855a8ab6dcea98c35738a7 (diff)
downloadpaludis-78d9a9bf0758140e0e8c03c5e8d3288f74efbb51.tar.gz
paludis-78d9a9bf0758140e0e8c03c5e8d3288f74efbb51.tar.xz
Switch to std mutex and condition_variable
Diffstat (limited to 'paludis/environments/paludis')
-rw-r--r--paludis/environments/paludis/keywords_conf.cc12
-rw-r--r--paludis/environments/paludis/licenses_conf.cc16
-rw-r--r--paludis/environments/paludis/package_mask_conf.cc14
-rw-r--r--paludis/environments/paludis/paludis_config.cc24
-rw-r--r--paludis/environments/paludis/paludis_environment.cc14
-rw-r--r--paludis/environments/paludis/suggestions_conf.cc12
-rw-r--r--paludis/environments/paludis/world.cc10
7 files changed, 48 insertions, 54 deletions
diff --git a/paludis/environments/paludis/keywords_conf.cc b/paludis/environments/paludis/keywords_conf.cc
index 4837cfb12..bf99ed348 100644
--- a/paludis/environments/paludis/keywords_conf.cc
+++ b/paludis/environments/paludis/keywords_conf.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -34,14 +34,14 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/set.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_null_shared_ptr.hh>
-#include <unordered_map>
#include <list>
-#include <vector>
#include <map>
+#include <mutex>
+#include <unordered_map>
+#include <vector>
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -64,7 +64,7 @@ namespace paludis
SpecificMap qualified;
UnspecificMap unqualified;
mutable NamedSetMap set;
- mutable Mutex set_mutex;
+ mutable std::mutex set_mutex;
Imp(const PaludisEnvironment * const e) :
env(e)
@@ -173,7 +173,7 @@ KeywordsConf::query(const std::shared_ptr<const KeywordNameSet> & k, const std::
/* next: named sets */
{
- Lock lock(_imp->set_mutex);
+ std::unique_lock<std::mutex> lock(_imp->set_mutex);
for (NamedSetMap::iterator i(_imp->set.begin()), i_end(_imp->set.end()) ;
i != i_end ; ++i)
diff --git a/paludis/environments/paludis/licenses_conf.cc b/paludis/environments/paludis/licenses_conf.cc
index a9e9b5421..be975ff83 100644
--- a/paludis/environments/paludis/licenses_conf.cc
+++ b/paludis/environments/paludis/licenses_conf.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -32,16 +32,16 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/set.hh>
-#include <unordered_map>
#include <list>
-#include <vector>
#include <map>
+#include <mutex>
+#include <unordered_map>
+#include <vector>
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -64,8 +64,8 @@ namespace paludis
mutable SpecificMap qualified;
mutable UnspecificMap unqualified;
mutable NamedSetMap set;
- mutable Mutex set_mutex;
- mutable Mutex expanded_mutex;
+ mutable std::mutex set_mutex;
+ mutable std::mutex expanded_mutex;
mutable bool expanded;
Imp(const PaludisEnvironment * const e) :
@@ -168,7 +168,7 @@ bool
LicensesConf::query(const std::string & t, const std::shared_ptr<const PackageID> & e) const
{
{
- Lock lock(_imp->expanded_mutex);
+ std::unique_lock<std::mutex> lock(_imp->expanded_mutex);
if (! _imp->expanded)
{
_imp->expanded = true;
@@ -224,7 +224,7 @@ LicensesConf::query(const std::string & t, const std::shared_ptr<const PackageID
/* next: named sets */
{
- Lock lock(_imp->set_mutex);
+ std::unique_lock<std::mutex> lock(_imp->set_mutex);
for (NamedSetMap::iterator i(_imp->set.begin()), i_end(_imp->set.end()) ;
i != i_end ; ++i)
{
diff --git a/paludis/environments/paludis/package_mask_conf.cc b/paludis/environments/paludis/package_mask_conf.cc
index 532453aab..ae82223d5 100644
--- a/paludis/environments/paludis/package_mask_conf.cc
+++ b/paludis/environments/paludis/package_mask_conf.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -34,14 +34,14 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_null_shared_ptr.hh>
-#include <vector>
-#include <list>
-#include <set>
#include <algorithm>
#include <functional>
+#include <list>
+#include <mutex>
+#include <set>
+#include <vector>
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -57,7 +57,7 @@ namespace paludis
const bool allow_reasons;
std::list<std::pair<std::shared_ptr<const PackageDepSpec>, std::set<std::string> > > masks;
mutable Sets sets;
- mutable Mutex set_mutex;
+ mutable std::mutex set_mutex;
Imp(const PaludisEnvironment * const e, const bool a) :
env(e),
@@ -136,7 +136,7 @@ PackageMaskConf::query(const std::shared_ptr<const PackageID> & e, const std::st
}
{
- Lock lock(_imp->set_mutex);
+ std::unique_lock<std::mutex> lock(_imp->set_mutex);
for (Sets::iterator it(_imp->sets.begin()),
it_end(_imp->sets.end()); it_end != it; ++it)
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index f70154b7f..5f7b777bd 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -40,7 +40,6 @@
#include <paludis/util/system.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
@@ -65,6 +64,7 @@
#include <list>
#include <map>
#include <vector>
+#include <mutex>
#include <ctype.h>
#include <sys/types.h>
@@ -73,12 +73,6 @@
#include "config.h"
-/** \file
- * Imp of paludis_config.hh classes.
- *
- * \ingroup grppaludisconfig
- */
-
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -175,7 +169,7 @@ namespace paludis
std::string root;
std::string system_root;
std::string config_dir;
- mutable Mutex distribution_mutex;
+ mutable std::mutex distribution_mutex;
mutable std::string distribution;
std::shared_ptr<FSPathSequence> bashrc_files;
@@ -194,11 +188,11 @@ namespace paludis
std::shared_ptr<SuggestionsConf> suggestions_conf;
mutable std::shared_ptr<World> world;
- mutable Mutex reduced_mutex;
+ mutable std::mutex reduced_mutex;
mutable std::shared_ptr<uid_t> reduced_uid;
mutable std::shared_ptr<gid_t> reduced_gid;
- mutable Mutex general_conf_mutex;
+ mutable std::mutex general_conf_mutex;
mutable bool has_general_conf;
mutable bool accept_all_breaks_portage;
mutable Set<std::string> accept_breaks_portage;
@@ -234,7 +228,7 @@ namespace paludis
void
Imp<PaludisConfig>::need_general_conf() const
{
- Lock lock(general_conf_mutex);
+ std::unique_lock<std::mutex> lock(general_conf_mutex);
if (has_general_conf)
return;
@@ -1002,7 +996,7 @@ PaludisConfig::config_dir() const
uid_t
PaludisConfig::reduced_uid() const
{
- Lock lock(_imp->reduced_mutex);
+ std::unique_lock<std::mutex> lock(_imp->reduced_mutex);
if (! _imp->reduced_uid)
{
@@ -1033,7 +1027,7 @@ PaludisConfig::reduced_uid() const
gid_t
PaludisConfig::reduced_gid() const
{
- Lock lock(_imp->reduced_mutex);
+ std::unique_lock<std::mutex> lock(_imp->reduced_mutex);
if (! _imp->reduced_gid)
{
@@ -1142,7 +1136,7 @@ PaludisConfig::world() const
std::string
PaludisConfig::distribution() const
{
- Lock lock(_imp->distribution_mutex);
+ std::unique_lock<std::mutex> lock(_imp->distribution_mutex);
if (! _imp->distribution.empty())
return _imp->distribution;
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index cbe070816..c92972f15 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -49,7 +49,6 @@
#include <paludis/util/strip.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/map.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/options.hh>
@@ -65,6 +64,7 @@
#include <algorithm>
#include <list>
#include <map>
+#include <mutex>
#include <unistd.h>
using namespace paludis;
@@ -75,14 +75,14 @@ namespace paludis
template<>
struct Imp<PaludisEnvironment>
{
- mutable Mutex hook_mutex;
+ mutable std::mutex hook_mutex;
mutable bool done_hooks;
mutable std::shared_ptr<Hooker> hooker;
mutable std::list<std::pair<FSPath, bool> > hook_dirs;
std::shared_ptr<PaludisConfig> config;
- mutable Mutex sets_mutex;
+ mutable std::mutex sets_mutex;
mutable std::map<SetName, std::shared_ptr<const SetSpecTree> > sets;
std::shared_ptr<LiteralMetadataValueKey<std::string> > format_key;
@@ -206,7 +206,7 @@ PaludisEnvironment::perform_hook(
const Hook & hook,
const std::shared_ptr<OutputManager> & optional_output_manager) const
{
- Lock lock(_imp->hook_mutex);
+ std::unique_lock<std::mutex> lock(_imp->hook_mutex);
if (! _imp->hooker)
{
@@ -223,7 +223,7 @@ PaludisEnvironment::perform_hook(
std::shared_ptr<const FSPathSequence>
PaludisEnvironment::hook_dirs() const
{
- Lock lock(_imp->hook_mutex);
+ std::unique_lock<std::mutex> lock(_imp->hook_mutex);
_imp->need_hook_dirs(FSPath(_imp->config->config_dir()));
@@ -514,7 +514,7 @@ namespace
void
PaludisEnvironment::populate_sets() const
{
- Lock lock(_imp->sets_mutex);
+ std::unique_lock<std::mutex> lock(_imp->sets_mutex);
add_set(SetName("world"), SetName("world::environment"), std::bind(&make_world_set, _imp->config->world()), true);
std::list<FSPath> sets_dirs;
diff --git a/paludis/environments/paludis/suggestions_conf.cc b/paludis/environments/paludis/suggestions_conf.cc
index 65c026d91..66304ffc8 100644
--- a/paludis/environments/paludis/suggestions_conf.cc
+++ b/paludis/environments/paludis/suggestions_conf.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -26,7 +26,6 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/hashes.hh>
@@ -39,10 +38,11 @@
#include <paludis/match_package.hh>
#include <paludis/package_id.hh>
#include <paludis/dep_spec_annotations.hh>
-#include <unordered_map>
#include <list>
-#include <vector>
#include <map>
+#include <mutex>
+#include <unordered_map>
+#include <vector>
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -105,7 +105,7 @@ namespace paludis
SpecificMap qualified;
UnspecificMap unqualified;
mutable NamedSetMap set;
- mutable Mutex set_mutex;
+ mutable std::mutex set_mutex;
Imp(const PaludisEnvironment * const e) :
env(e)
@@ -223,7 +223,7 @@ SuggestionsConf::interest_in_suggestion(
/* next: named sets */
{
- Lock lock(_imp->set_mutex);
+ std::unique_lock<std::mutex> lock(_imp->set_mutex);
for (NamedSetMap::iterator i(_imp->set.begin()), i_end(_imp->set.end()) ;
i != i_end ; ++i)
{
diff --git a/paludis/environments/paludis/world.cc b/paludis/environments/paludis/world.cc
index b546d4f5d..5d5af6ca0 100644
--- a/paludis/environments/paludis/world.cc
+++ b/paludis/environments/paludis/world.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009, 2010, 2011 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010, 2011, 2013 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,7 +19,6 @@
#include <paludis/environments/paludis/world.hh>
#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/mutex.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/log.hh>
#include <paludis/util/make_named_values.hh>
@@ -29,6 +28,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <functional>
+#include <mutex>
using namespace paludis;
using namespace paludis::paludis_environment;
@@ -40,7 +40,7 @@ namespace paludis
{
const Environment * const env;
const std::shared_ptr<const FSPath> maybe_world_file;
- mutable Mutex mutex;
+ mutable std::mutex mutex;
Imp(const Environment * const e, const std::shared_ptr<const FSPath> & m) :
env(e),
@@ -97,7 +97,7 @@ World::_add_string_to_world(const std::string & n) const
return false;
}
- Lock l(_imp->mutex);
+ std::unique_lock<std::mutex> lock(_imp->mutex);
Context context("When adding '" + n + "' to world file '" + stringify(*_imp->maybe_world_file) + "':");
@@ -141,7 +141,7 @@ World::_remove_string_from_world(const std::string & n) const
return result;
}
- Lock l(_imp->mutex);
+ std::unique_lock<std::mutex> lock(_imp->mutex);
Context context("When removing '" + n + "' from world file '" + stringify(*_imp->maybe_world_file) + "':");