aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-02-07 08:02:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:42 +0200
commitbe773edfa2c8f8f3230509bbd713542d20fbb37e (patch)
tree4fe55dff87a091e2d08cbc32022c4729874fa466
parent03c02a746ceef003366d3fb928499c327e8da69a (diff)
Use const scheduler task count where appropriate
-rw-r--r--build2/scheduler8
-rw-r--r--build2/scheduler.cxx10
2 files changed, 9 insertions, 9 deletions
diff --git a/build2/scheduler b/build2/scheduler
index 5b0f566..16cc217 100644
--- a/build2/scheduler
+++ b/build2/scheduler
@@ -96,10 +96,10 @@ namespace build2
// an alternative (lower) start count.
//
void
- wait (size_t start_count, atomic_count& task_count);
+ wait (size_t start_count, const atomic_count& task_count);
void
- wait (atomic_count& task_count)
+ wait (const atomic_count& task_count)
{
wait (0, task_count);
}
@@ -107,7 +107,7 @@ namespace build2
// Resume threads waiting on this task count.
//
void
- resume (atomic_count& task_count);
+ resume (const atomic_count& task_count);
// Startup and shutdown.
//
@@ -232,7 +232,7 @@ namespace build2
helper (void*);
void
- suspend (size_t start_count, atomic_count& task_count);
+ suspend (size_t start_count, const atomic_count& task_count);
// Task encapsulation.
//
diff --git a/build2/scheduler.cxx b/build2/scheduler.cxx
index 013bbbc..edfa02c 100644
--- a/build2/scheduler.cxx
+++ b/build2/scheduler.cxx
@@ -11,7 +11,7 @@ using namespace std;
namespace build2
{
void scheduler::
- wait (size_t start_count, atomic_count& task_count)
+ wait (size_t start_count, const atomic_count& task_count)
{
if (task_count <= start_count)
return;
@@ -39,10 +39,10 @@ namespace build2
}
void scheduler::
- suspend (size_t start_count, atomic_count& tc)
+ suspend (size_t start_count, const atomic_count& tc)
{
wait_slot& s (
- wait_queue_[std::hash<atomic_count*> () (&tc) % wait_queue_size_]);
+ wait_queue_[std::hash<const atomic_count*> () (&tc) % wait_queue_size_]);
// This thread is no longer active.
//
@@ -121,13 +121,13 @@ namespace build2
}
void scheduler::
- resume (atomic_count& tc)
+ resume (const atomic_count& tc)
{
if (max_active_ == 1) // Serial execution, nobody to wakeup.
return;
wait_slot& s (
- wait_queue_[std::hash<atomic_count*> () (&tc) % wait_queue_size_]);
+ wait_queue_[std::hash<const atomic_count*> () (&tc) % wait_queue_size_]);
// See suspend() for why we must hold the lock.
//