proxygen
DistributedMutex.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-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 #pragma once
17 
18 #include <atomic>
19 #include <chrono>
20 #include <cstdint>
21 
22 namespace folly {
23 namespace detail {
24 namespace distributed_mutex {
25 
98 template <
99  template <typename> class Atomic = std::atomic,
100  bool TimePublishing = true>
102  public:
104 
111  DistributedMutex(const DistributedMutex&) = delete;
113  DistributedMutex& operator=(const DistributedMutex&) = delete;
114 
128 
137 
151 
162  template <typename Rep, typename Period>
164  const std::chrono::duration<Rep, Period>& duration);
165 
172  template <typename Clock, typename Duration>
174  const std::chrono::time_point<Clock, Duration>& deadline);
175 
176  private:
177  Atomic<std::uintptr_t> state_{0};
178 };
179 
180 } // namespace distributed_mutex
181 } // namespace detail
182 
188 
189 } // namespace folly
190 
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
DistributedMutex & operator=(DistributedMutex &&)=delete
DistributedMutexStateProxy try_lock_until(const std::chrono::time_point< Clock, Duration > &deadline)
DistributedMutexStateProxy try_lock_for(const std::chrono::duration< Rep, Period > &duration)