proxygen
WaitOptions.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <chrono>
20 
21 #include <folly/CPortability.h>
22 
23 namespace folly {
24 
30 class WaitOptions {
31  public:
32  struct Defaults {
54  static constexpr std::chrono::nanoseconds spin_max =
55  std::chrono::microseconds(2);
56  };
57 
58  std::chrono::nanoseconds spin_max() const {
59  return spin_max_;
60  }
61  WaitOptions& spin_max(std::chrono::nanoseconds dur) {
62  spin_max_ = dur;
63  return *this;
64  }
65 
66  private:
67  std::chrono::nanoseconds spin_max_ = Defaults::spin_max;
68 };
69 
70 } // namespace folly
std::chrono::nanoseconds spin_max() const
Definition: WaitOptions.h:58
WaitOptions & spin_max(std::chrono::nanoseconds dur)
Definition: WaitOptions.h:61
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
std::chrono::nanoseconds spin_max_
Definition: WaitOptions.h:67
static constexpr std::chrono::nanoseconds spin_max
Definition: WaitOptions.h:54