1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15
16 #ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_MUTEX_H_
17 #define TENSORFLOW_CORE_PLATFORM_DEFAULT_MUTEX_H_
18
19 // IWYU pragma: private, include "third_party/tensorflow/core/platform/mutex.h"
20 // IWYU pragma: friend third_party/tensorflow/core/platform/mutex.h
21
22 namespace tensorflow {
23
24 namespace internal {
25 std::cv_status wait_until_system_clock(
26 CVData *cv_data, MuData *mu_data,
27 const std::chrono::system_clock::time_point timeout_time);
28 } // namespace internal
29
30 template <class Rep, class Period>
wait_for(mutex_lock & lock,std::chrono::duration<Rep,Period> dur)31 std::cv_status condition_variable::wait_for(
32 mutex_lock &lock, std::chrono::duration<Rep, Period> dur) {
33 return tensorflow::internal::wait_until_system_clock(
34 &this->cv_, &lock.mutex()->mu_, std::chrono::system_clock::now() + dur);
35 }
36
37 } // namespace tensorflow
38
39 #endif // TENSORFLOW_CORE_PLATFORM_DEFAULT_MUTEX_H_
40