Kernel: pass ref to sempahore

This commit is contained in:
Weiyi Wang 2018-10-12 16:12:08 -04:00
parent 181646679c
commit 247249d5d3
5 changed files with 21 additions and 17 deletions

View file

@ -891,7 +891,8 @@ static ResultCode GetThreadId(u32* thread_id, Handle handle) {
/// Creates a semaphore
static ResultCode CreateSemaphore(Handle* out_handle, s32 initial_count, s32 max_count) {
CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
CASCADE_RESULT(SharedPtr<Semaphore> semaphore,
Core::System::GetInstance().Kernel().CreateSemaphore(initial_count, max_count));
semaphore->name = fmt::format("semaphore-{:08x}", Core::CPU().GetReg(14));
CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(semaphore)));