Tons and tons of cleanup and cruft removal

This commit is contained in:
Adam Ierymenko 2019-08-21 14:24:45 -07:00
parent 5280d28505
commit 0b5472f9fb
No known key found for this signature in database
GPG key ID: 1657198823E52A61
17 changed files with 202 additions and 377 deletions

View file

@ -51,17 +51,14 @@ public:
inline void lock() const
{
const uint16_t myTicket = __sync_fetch_and_add(&(const_cast<Mutex *>(this)->nextTicket),1);
const uint16_t myTicket = __sync_fetch_and_add(&(const_cast<Mutex *>(this)->nextTicket),1);
while (nowServing != myTicket) {
__asm__ __volatile__("rep;nop"::);
__asm__ __volatile__("":::"memory");
}
}
}
inline void unlock() const
{
++(const_cast<Mutex *>(this)->nowServing);
}
inline void unlock() const { ++(const_cast<Mutex *>(this)->nowServing); }
/**
* Uses C++ contexts and constructor/destructor to lock/unlock automatically