mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
Kernel: Make TID's be unique PID's
This is a little strange, but it's how I understand things should work. The first thread in a new process now has TID == PID. Additional threads subsequently spawned in that process all have unique TID's generated by the PID allocator. TIDs are now globally unique.
This commit is contained in:
parent
16812f0f98
commit
4b8851bd01
3 changed files with 14 additions and 2 deletions
|
@ -43,9 +43,14 @@ HashTable<Thread*>& thread_table()
|
|||
|
||||
Thread::Thread(Process& process)
|
||||
: m_process(process)
|
||||
, m_tid(process.m_next_tid++)
|
||||
, m_name(process.name())
|
||||
{
|
||||
if (m_process.m_thread_count == 0) {
|
||||
// First thread gets TID == PID
|
||||
m_tid = process.pid();
|
||||
} else {
|
||||
m_tid = Process::allocate_pid();
|
||||
}
|
||||
process.m_thread_count++;
|
||||
dbgprintf("Thread{%p}: New thread TID=%u in %s(%u)\n", this, m_tid, process.name().characters(), process.pid());
|
||||
set_default_signal_dispositions();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue