VTK  9.2.20230328
vtkAtomicMutex.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAtomicMutex.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkAtomicMutex_h
28 #define vtkAtomicMutex_h
29 
30 #include "vtkCommonCoreModule.h" // For export macro
31 #include <atomic> // For std::atomic
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 
35 class VTKCOMMONCORE_EXPORT vtkAtomicMutex
36 {
37 public:
38  // left public purposely to allow for copy construction
40  ~vtkAtomicMutex() = default;
43 
45 
52  void lock();
53  void unlock();
55 private:
56  std::atomic_bool Locked;
57 };
58 
59 VTK_ABI_NAMESPACE_END
60 #endif // vtkAtomicMutex_h
61 // VTK-HeaderTest-Exclude: vtkAtomicMutex.h
mutual exclusion locking class using atomic operations
vtkAtomicMutex & operator=(const vtkAtomicMutex &other)
~vtkAtomicMutex()=default
void lock()
Lock/Unlock atomic operation.
vtkAtomicMutex(const vtkAtomicMutex &other)
void unlock()
Lock/Unlock atomic operation.