Kernel: New handle manager

This handle manager more closely mirrors the behaviour of the CTR-OS
one. In addition object ref-counts and support for DuplicateHandle have
been added.

Note that support for DuplicateHandle is still experimental, since parts
of the kernel still use Handles internally, which will likely cause
troubles if two different handles to the same object are used to e.g.
wait on a synchronization primitive.
This commit is contained in:
Yuri Kunde Schlesner 2014-12-21 10:04:08 -02:00
parent 23f2142009
commit 7e2903cb74
13 changed files with 229 additions and 188 deletions

View file

@ -341,7 +341,8 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
Thread* thread = new Thread;
handle = Kernel::g_handle_table.Create(thread);
// TOOD(yuriks): Fix error reporting
handle = Kernel::g_handle_table.Create(thread).ValueOr(INVALID_HANDLE);
thread_queue.push_back(handle);
thread_ready_queue.prepare(priority);