mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Remove process & thread self-handles
For the coming switch to cap/handle ref-counting being the main lifetime determiner of objects, get rid of self handles for threads and processes to avoid circular references. Instead, passing 0 to syscalls expecting a thread or process handle signifies "this process/thread".
This commit is contained in:
@@ -24,8 +24,6 @@ process::process() :
|
||||
kobject {kobject::type::process},
|
||||
m_state {state::running}
|
||||
{
|
||||
m_self_handle = g_cap_table.create(this, process::self_caps);
|
||||
add_handle(m_self_handle);
|
||||
}
|
||||
|
||||
// The "kernel process"-only constructor
|
||||
@@ -71,28 +69,6 @@ process::exit(int32_t code)
|
||||
current.exit();
|
||||
}
|
||||
|
||||
void
|
||||
process::update()
|
||||
{
|
||||
util::scoped_lock lock {m_threads_lock};
|
||||
|
||||
kassert(false, "process::update used!");
|
||||
kassert(m_threads.count() > 0, "process::update with zero threads!");
|
||||
|
||||
size_t i = 0;
|
||||
while (i < m_threads.count()) {
|
||||
thread *th = m_threads[i];
|
||||
if (th->has_state(thread::state::exited)) {
|
||||
m_threads.remove_swap_at(i);
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (m_threads.count() == 0)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
thread *
|
||||
process::create_thread(uintptr_t rsp3, uint8_t priority)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user