aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/eclass_mtimes.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-16 23:22:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-16 23:22:14 +0000
commite35be9c529c32f636b376b248cb6395ae8d0f798 (patch)
tree715610bdb10abd7f577cbfbf0163fcbf029a3bca /paludis/repositories/e/eclass_mtimes.cc
parentfb83da0d4cc49e419644d4f6916df94b36f784c6 (diff)
downloadpaludis-e35be9c529c32f636b376b248cb6395ae8d0f798.tar.gz
paludis-e35be9c529c32f636b376b248cb6395ae8d0f798.tar.xz
Be thread safe.
Diffstat (limited to 'paludis/repositories/e/eclass_mtimes.cc')
-rw-r--r--paludis/repositories/e/eclass_mtimes.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/paludis/repositories/e/eclass_mtimes.cc b/paludis/repositories/e/eclass_mtimes.cc
index 60a630c3f..a7d3dbc67 100644
--- a/paludis/repositories/e/eclass_mtimes.cc
+++ b/paludis/repositories/e/eclass_mtimes.cc
@@ -22,6 +22,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/mutex.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -33,6 +34,7 @@ namespace paludis
struct Implementation<EclassMtimes>
{
tr1::shared_ptr<const FSEntrySequence> eclass_dirs;
+ mutable Mutex mutex;
mutable MakeHashedMap<std::string, time_t>::Type eclass_mtimes;
Implementation(tr1::shared_ptr<const FSEntrySequence> d) :
@@ -54,6 +56,8 @@ EclassMtimes::~EclassMtimes()
time_t
EclassMtimes::mtime(const std::string & e) const
{
+ Lock l(_imp->mutex);
+
MakeHashedMap<std::string, time_t>::Type::const_iterator i(_imp->eclass_mtimes.find(e));
if (i != _imp->eclass_mtimes.end())
return i->second;