mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
Kernel: Make Threads always have a name
We previously allowed Thread to exist in a state where its m_name was null, and had to work around that in various places. This patch removes that possibility and forces those who would create a thread (or change the name of one) to provide a NonnullOwnPtr<KString> with the name.
This commit is contained in:
parent
cda2b9e71c
commit
7981422500
7 changed files with 25 additions and 13 deletions
|
@ -194,10 +194,10 @@ public:
|
|||
{
|
||||
// NOTE: Whoever is calling this needs to be holding our lock while reading the name.
|
||||
VERIFY(m_lock.is_locked_by_current_processor());
|
||||
return m_name ? m_name->view() : StringView {};
|
||||
return m_name->view();
|
||||
}
|
||||
|
||||
void set_name(OwnPtr<KString> name)
|
||||
void set_name(NonnullOwnPtr<KString> name)
|
||||
{
|
||||
SpinlockLocker lock(m_lock);
|
||||
m_name = move(name);
|
||||
|
@ -1202,7 +1202,7 @@ public:
|
|||
String backtrace();
|
||||
|
||||
private:
|
||||
Thread(NonnullRefPtr<Process>, NonnullOwnPtr<Memory::Region>, NonnullRefPtr<Timer>, OwnPtr<KString>);
|
||||
Thread(NonnullRefPtr<Process>, NonnullOwnPtr<Memory::Region>, NonnullRefPtr<Timer>, NonnullOwnPtr<KString>);
|
||||
|
||||
IntrusiveListNode<Thread> m_process_thread_list_node;
|
||||
int m_runnable_priority { -1 };
|
||||
|
@ -1333,7 +1333,7 @@ private:
|
|||
|
||||
FPUState m_fpu_state {};
|
||||
State m_state { Invalid };
|
||||
OwnPtr<KString> m_name;
|
||||
NonnullOwnPtr<KString> m_name;
|
||||
u32 m_priority { THREAD_PRIORITY_NORMAL };
|
||||
|
||||
State m_stop_state { Invalid };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue