aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-16 10:31:20 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-16 11:08:36 +0100
commit4d710364915b2a76153e889775f1022c35fa88fa (patch)
tree8eea48c82ee85b8d3f7fb95347d43a4b266783cd
parentbc40773cfa75a993f09a80e438bfa54d6e51c4ae (diff)
downloadpaludis-4d710364915b2a76153e889775f1022c35fa88fa.tar.gz
paludis-4d710364915b2a76153e889775f1022c35fa88fa.tar.xz
Let executors specify flush time delays
-rw-r--r--paludis/util/executor.cc12
-rw-r--r--paludis/util/executor.hh2
2 files changed, 8 insertions, 6 deletions
diff --git a/paludis/util/executor.cc b/paludis/util/executor.cc
index f0a67ed..68f3f1a 100644
--- a/paludis/util/executor.cc
+++ b/paludis/util/executor.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 2010 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
@@ -41,6 +41,7 @@ namespace paludis
template <>
struct Implementation<Executor>
{
+ int ms_update_interval;
int pending;
int active;
int done;
@@ -50,7 +51,8 @@ namespace paludis
Mutex mutex;
ConditionVariable condition;
- Implementation() :
+ Implementation(int u) :
+ ms_update_interval(u),
pending(0),
active(0),
done(0)
@@ -59,8 +61,8 @@ namespace paludis
};
}
-Executor::Executor() :
- PrivateImplementationPattern<Executor>(new Implementation<Executor>)
+Executor::Executor(int ms_update_interval) :
+ PrivateImplementationPattern<Executor>(new Implementation<Executor>(ms_update_interval))
{
}
@@ -139,7 +141,7 @@ Executor::execute()
if ((! any) && running.empty())
break;
- _imp->condition.timed_wait(_imp->mutex, 1);
+ _imp->condition.timed_wait(_imp->mutex, _imp->ms_update_interval / 1000, _imp->ms_update_interval % 1000);
for (Running::iterator r(running.begin()), r_end(running.end()) ;
r != r_end ; ++r)
diff --git a/paludis/util/executor.hh b/paludis/util/executor.hh
index e5787a3..f0d2e45 100644
--- a/paludis/util/executor.hh
+++ b/paludis/util/executor.hh
@@ -50,7 +50,7 @@ namespace paludis
void _one(const std::tr1::shared_ptr<Executive>);
public:
- Executor();
+ explicit Executor(const int ms_update_interval = 1000);
~Executor();
int pending() const;