blob: f9f0f2e488901ec08c9cd4b8839bcdb092e235eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// file : libbuild2/scheduler.ixx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
namespace build2
{
inline scheduler::queue_mark::
queue_mark (scheduler& s)
: tq_ (s.queue ())
{
if (tq_ != nullptr)
{
lock ql (tq_->mutex);
if (tq_->mark != s.task_queue_depth_)
{
om_ = tq_->mark;
tq_->mark = s.task_queue_depth_;
}
else
tq_ = nullptr;
}
}
inline scheduler::queue_mark::
~queue_mark ()
{
if (tq_ != nullptr)
{
lock ql (tq_->mutex);
tq_->mark = tq_->size == 0 ? tq_->tail : om_;
}
}
}
|