VTK  9.3.1
vtkAtomicMutex.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkAtomicMutex_h
16 #define vtkAtomicMutex_h
17 
18 #include "vtkCommonCoreModule.h" // For export macro
19 #include <atomic> // For std::atomic
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 
23 class VTKCOMMONCORE_EXPORT vtkAtomicMutex
24 {
25 public:
26  // left public purposely to allow for copy construction
28  ~vtkAtomicMutex() = default;
29  vtkAtomicMutex(const vtkAtomicMutex& other);
30  vtkAtomicMutex& operator=(const vtkAtomicMutex& other);
31 
33 
40  void lock();
41  void unlock();
43 private:
44  std::atomic_bool Locked;
45 };
46 
47 VTK_ABI_NAMESPACE_END
48 #endif // vtkAtomicMutex_h
49 // VTK-HeaderTest-Exclude: vtkAtomicMutex.h
mutual exclusion locking class using atomic operations