diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
| commit | f95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch) | |
| tree | bf8186f1a0521a64983bb0bca4f7b54883542195 /Private/KernelKit/LockDelegate.hpp | |
| parent | 5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff) | |
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit/LockDelegate.hpp')
| -rw-r--r-- | Private/KernelKit/LockDelegate.hpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/Private/KernelKit/LockDelegate.hpp b/Private/KernelKit/LockDelegate.hpp index 3b4889c9..5b135625 100644 --- a/Private/KernelKit/LockDelegate.hpp +++ b/Private/KernelKit/LockDelegate.hpp @@ -9,56 +9,56 @@ #include <NewKit/Atom.hpp> #include <NewKit/Defines.hpp> -#define kLockDone (200U) /* job is done */ +#define kLockDone (200U) /* job is done */ #define kLockTimedOut (100U) /* job has timed out */ namespace NewOS { -/// @brief Lock condition pointer. -typedef Boolean* LockPtr; + /// @brief Lock condition pointer. + typedef Boolean* LockPtr; -/// @brief Locking delegate class, hangs until limit. -/// @tparam N the amount of cycles to wait. -template <SizeT N> -class LockDelegate final -{ - public: - LockDelegate() = delete; + /// @brief Locking delegate class, hangs until limit. + /// @tparam N the amount of cycles to wait. + template <SizeT N> + class LockDelegate final + { + public: + LockDelegate() = delete; + + public: + explicit LockDelegate(LockPtr expr) + { + auto spin = 0U; - public: - explicit LockDelegate(LockPtr expr) - { - auto spin = 0U; - - while (spin != N) - { - if (*expr) - { - fLockStatus | kLockDone; - break; - } - } + while (spin != N) + { + if (*expr) + { + fLockStatus | kLockDone; + break; + } + } - if (spin == N) - fLockStatus | kLockTimedOut; - } + if (spin == N) + fLockStatus | kLockTimedOut; + } - ~LockDelegate() = default; + ~LockDelegate() = default; - LockDelegate &operator=(const LockDelegate &) = delete; - LockDelegate(const LockDelegate &) = delete; + LockDelegate& operator=(const LockDelegate&) = delete; + LockDelegate(const LockDelegate&) = delete; - bool Done() - { - return fLockStatus[kLockDone] == kLockDone; - } + bool Done() + { + return fLockStatus[kLockDone] == kLockDone; + } - bool HasTimedOut() - { - return fLockStatus[kLockTimedOut] != kLockTimedOut; - } + bool HasTimedOut() + { + return fLockStatus[kLockTimedOut] != kLockTimedOut; + } - private: - Atom<UInt> fLockStatus; -}; + private: + Atom<UInt> fLockStatus; + }; } // namespace NewOS |
