| 8 | #include <vector> |
| 9 | |
| 10 | class semaphore { |
| 11 | public: |
| 12 | explicit semaphore(std::size_t limit) : chan_{limit} {} |
| 13 | |
| 14 | void acquire() { chan_ << empty_; } |
| 15 | |
| 16 | void release() { chan_ >> empty_; } |
| 17 | |
| 18 | private: |
| 19 | struct empty {}; |
| 20 | msd::channel<empty> chan_; |
| 21 | empty empty_{}; // See EBO starting C++20: https://en.cppreference.com/w/cpp/language/ebo.html |
| 22 | }; |
| 23 | |
| 24 | int simulate_heavy_computation(const int value) |
| 25 | { |
nothing calls this directly
no outgoing calls
no test coverage detected