Merge branch 'main' of gitlab.ibr.cs.tu-bs.de:vss/teaching/ws25/v_bsb2/stubsmi

This commit is contained in:
2026-02-06 23:09:43 +01:00
31 changed files with 402 additions and 3388 deletions

View File

@@ -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