Merge branch 'main' of gitlab.ibr.cs.tu-bs.de:vss/teaching/ws25/v_bsb2/stubsmi
This commit is contained in:
@@ -24,16 +24,16 @@ class Thread;
|
||||
class Semaphore {
|
||||
// Prevent copies and assignments
|
||||
Semaphore(const Semaphore&) = delete;
|
||||
Semaphore(Semaphore&&) = delete;
|
||||
Semaphore& operator=(const Semaphore&) = delete;
|
||||
Queue<Thread> waiting;
|
||||
|
||||
public:
|
||||
/*! \brief Constructor; initialized the counter with provided value `c`
|
||||
* \param c Initial counter value
|
||||
/*! \param init Initial counter value
|
||||
*/
|
||||
explicit Semaphore(unsigned c = 0) : counter(c) {}
|
||||
unsigned counter;
|
||||
bool used;
|
||||
bool used;
|
||||
/*! \brief Wait for access to the critical area.
|
||||
*
|
||||
* Enter/decrement/wait operation: If the counter is greater than 0, then
|
||||
|
||||
Reference in New Issue
Block a user