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 <FMEThirdPartyWarningsDisable.h>
9#include <cstddef>
10#include <mutex>
11#include <condition_variable>
12#include <FMEThirdPartyWarningsRestore.h>
13
14
15namespace asio {
16
40 {
41 public:
42
44 Semaphore(const Semaphore&) = default;
45 Semaphore& operator=(const Semaphore&) = default;
47
48 void increment();
49
50 void decrement();
51
52 private:
53
54 std::size_t count;
55 std::mutex mutex;
56 std::condition_variable is_zero;
57 };
58
59
85
86}
#define ASYNCHRONOUSIO_EXPORT
Definition System.h:10
A scoped semaphore access object that increments on construction and decrements on destruction.
Definition Semaphore.h:73
ScopedSemaphoreAccess(const ScopedSemaphoreAccess &other)
ScopedSemaphoreAccess & operator=(const ScopedSemaphoreAccess &)=default
ScopedSemaphoreAccess(Semaphore &semaphore)
A simple semaphore with increment and decrement functionality.
Definition Semaphore.h:40
Semaphore & operator=(const Semaphore &)=default
Semaphore(const Semaphore &)=default