VTK  9.2.6
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 class VTKCOMMONCORE_EXPORT vtkAtomicMutex
34 {
35 public:
36  // left public purposely to allow for copy construction
38  ~vtkAtomicMutex() = default;
39  vtkAtomicMutex(const vtkAtomicMutex& other);
40  vtkAtomicMutex& operator=(const vtkAtomicMutex& other);
41 
43 
50  void lock();
51  void unlock();
53 private:
54  std::atomic_bool Locked;
55 };
56 
57 #endif // vtkAtomicMutex_h
58 // VTK-HeaderTest-Exclude: vtkAtomicMutex.h
mutual exclusion locking class using atomic operations