NVIDIA DeepStream SDK API Reference

6.4 Release
signalshot.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 
14 #ifndef DS3D_COMMON_HELPER_SIGNALSHOT_H
15 #define DS3D_COMMON_HELPER_SIGNALSHOT_H
16 
17 #include <ds3d/common/common.h>
18 
19 namespace ds3d {
20 
21 class SignalShot {
22  std::mutex _mutex;
23  std::condition_variable _cond;
24 
25 public:
26  void wait(uint64_t msec)
27  {
28  std::chrono::milliseconds t(msec);
29  std::unique_lock<std::mutex> locker(_mutex);
30  _cond.wait_for(locker, t);
31  }
32  void signal() { _cond.notify_all(); }
33  std::mutex& mutex() { return _mutex; }
34 };
35 
36 } // namespace ds3d
37 
38 #endif //
ds3d::SignalShot
Definition: signalshot.h:21
ds3d::SignalShot::mutex
std::mutex & mutex()
Definition: signalshot.h:33
ds3d::SignalShot::wait
void wait(uint64_t msec)
Definition: signalshot.h:26
ds3d::SignalShot::signal
void signal()
Definition: signalshot.h:32
common.h
ds3d
Definition: lidar_3d_datatype.h:33