aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/gate.h
blob: 315adb2939e1f1b2f4a973b719fd8e22f4211ad5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "count_down_latch.h"

namespace vespalib {

/**
 * A gate is a countdown latch with an initial count of 1, indicating
 * that we are only waiting for a single operation to complete.
 **/
class Gate : public CountDownLatch
{
public:
    /**
     * Sets the initial count to 1.
     **/
    Gate() noexcept : CountDownLatch(1) {}
    ~Gate() override;
};

} // namespace vespalib