Skip to content

Commit

Permalink
binary semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
petiaccja committed Mar 9, 2024
1 parent c22084b commit cc83fc7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/asyncpp/semaphore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace asyncpp {


class counting_semaphore {
struct awaitable {
counting_semaphore* m_owner = nullptr;
Expand Down Expand Up @@ -51,4 +52,11 @@ class counting_semaphore {
const ptrdiff_t m_max;
};


class binary_semaphore : public counting_semaphore {
public:
binary_semaphore(bool is_free = false) : counting_semaphore(ptrdiff_t(is_free), 1) {}
};


} // namespace asyncpp

0 comments on commit cc83fc7

Please sign in to comment.