diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-29 02:07:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-29 02:21:01 +0200 |
commit | 6ae60137d78aa2934625e19643dbd24d39687ce4 (patch) | |
tree | 2604ec521e9eafe53ec3c4e43c8469b10929dba1 /Kernel | |
parent | a28cd921a1df15a51555284cb74efc7d8758812f (diff) | |
download | serenity-6ae60137d78aa2934625e19643dbd24d39687ce4.zip |
Kernel: Use StringView instead of C strings in Mutex
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Locking/Mutex.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/Locking/Mutex.h b/Kernel/Locking/Mutex.h index 481c8fc9fa..f64153f63f 100644 --- a/Kernel/Locking/Mutex.h +++ b/Kernel/Locking/Mutex.h @@ -26,7 +26,7 @@ class Mutex { public: using Mode = LockMode; - Mutex(const char* name = nullptr) + Mutex(StringView name = {}) : m_name(name) { } @@ -52,19 +52,19 @@ public: return false; } - [[nodiscard]] const char* name() const { return m_name; } + [[nodiscard]] StringView name() const { return m_name; } - static const char* mode_to_string(Mode mode) + static StringView mode_to_string(Mode mode) { switch (mode) { case Mode::Unlocked: - return "unlocked"; + return "unlocked"sv; case Mode::Exclusive: - return "exclusive"; + return "exclusive"sv; case Mode::Shared: - return "shared"; + return "shared"sv; default: - return "invalid"; + return "invalid"sv; } } @@ -80,7 +80,7 @@ private: void block(Thread&, Mode, SpinlockLocker<Spinlock<u8>>&, u32); void unblock_waiters(Mode); - const char* m_name { nullptr }; + StringView m_name; Mode m_mode { Mode::Unlocked }; // When locked exclusively, only the thread already holding the lock can |