added spinlock

main
Simon 6 months ago
parent 9afe202078
commit e4e7cb9d0c

@ -115,7 +115,7 @@ extern "C" int main_ap() {
DBG << "test\n" << flush;
DBG << static_cast<int>(LAPIC::getID()) << endl << flush;
assert(Core::getID() != 1);
//assert(Core::getID() != 1);
Application{}.action();
return 0;

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

Loading…
Cancel
Save