Merge branch 'main' of gitlab.ibr.cs.tu-bs.de:vss/teaching/ss25/v_bsb1/Gruppe_018

main
Eggert Jung 6 months ago
commit bddcebefae

@ -35,14 +35,15 @@ class Spinlock {
// Prevent copies and assignments // Prevent copies and assignments
Spinlock(const Spinlock& copy) = delete; Spinlock(const Spinlock& copy) = delete;
Spinlock& operator=(const Spinlock&) = delete; Spinlock& operator=(const Spinlock&) = delete;
private:
volatile uint64_t locked;
public: public:
/*! \brief Constructor; Initializes as unlocked. /*! \brief Constructor; Initializes as unlocked.
* *
* \todo(12) Complete Constructor (for \MPStuBS, or use \ref Ticketlock) * \todo(12) Complete Constructor (for \MPStuBS, or use \ref Ticketlock)
* *
*/ */
consteval Spinlock() {} consteval Spinlock() : locked(0) {}
/*! \brief Enters the critical area. In case the area is already locked, /*! \brief Enters the critical area. In case the area is already locked,
* \ref lock() will actively wait until the area can be entered. * \ref lock() will actively wait until the area can be entered.
@ -50,11 +51,11 @@ class Spinlock {
* \see \ref Core::pause() * \see \ref Core::pause()
* \todo(12) Implement Method (for \MPStuBS, or use \ref Ticketlock) * \todo(12) Implement Method (for \MPStuBS, or use \ref Ticketlock)
*/ */
void lock() {} void lock();
/*! \brief Unblocks the critical area. /*! \brief Unblocks the critical area.
* *
* \todo(12) Implement Method (for \MPStuBS, or use \ref Ticketlock) * \todo(12) Implement Method (for \MPStuBS, or use \ref Ticketlock)
*/ */
void unlock() {} void unlock();
}; };

Loading…
Cancel
Save