MeVisLab Toolbox Reference
Semaphore.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 
4 #pragma once
5 
6 #include <asio/System.h>
7 
8 #include <ThirdPartyWarningsDisable.h>
9 #include <cstddef>
10 #include <mutex>
11 #include <condition_variable>
12 #include <ThirdPartyWarningsRestore.h>
13 
14 
15 namespace asio {
16 
40  {
41  public:
42 
44 
46 
47  void increment();
48 
49  void decrement();
50 
51  private:
52 
53  std::size_t count;
54  std::mutex mutex;
55  std::condition_variable is_zero;
56  };
57 
58 
72  {
73  public:
74 
76 
78 
80 
81  private:
82 
83  Semaphore* semaphore;
84  };
85 
86 }
#define ASYNCHRONOUSIO_EXPORT
Definition: System.h:9
A scoped semaphore access object that increments on construction and decrements on destruction.
Definition: Semaphore.h:72
ScopedSemaphoreAccess(const ScopedSemaphoreAccess &other)
ScopedSemaphoreAccess(Semaphore &semaphore)
A simple semaphore with increment and decrement functionality.
Definition: Semaphore.h:40