Kernel: Start using boost::intrusive_ptr for lifetime management

This commit is contained in:
Yuri Kunde Schlesner 2014-12-29 10:55:30 -02:00
parent d751de7341
commit 8ad41775cc
13 changed files with 96 additions and 91 deletions

View file

@ -66,7 +66,7 @@ ResultCode CreateTimer(Handle* handle, const ResetType reset_type, const std::st
}
ResultCode ClearTimer(Handle handle) {
Timer* timer = Kernel::g_handle_table.Get<Timer>(handle);
SharedPtr<Timer> timer = Kernel::g_handle_table.Get<Timer>(handle);
if (timer == nullptr)
return InvalidHandle(ErrorModule::Kernel);
@ -80,7 +80,7 @@ static int TimerCallbackEventType = -1;
/// The timer callback event, called when a timer is fired
static void TimerCallback(u64 timer_handle, int cycles_late) {
Timer* timer = Kernel::g_handle_table.Get<Timer>(timer_handle);
SharedPtr<Timer> timer = Kernel::g_handle_table.Get<Timer>(timer_handle);
if (timer == nullptr) {
LOG_CRITICAL(Kernel, "Callback fired for invalid timer %u", timer_handle);
@ -93,7 +93,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
// Resume all waiting threads
for (Handle thread_handle : timer->waiting_threads) {
if (Thread* thread = Kernel::g_handle_table.Get<Thread>(thread_handle))
if (SharedPtr<Thread> thread = Kernel::g_handle_table.Get<Thread>(thread_handle))
thread->ResumeFromWait();
}
@ -111,7 +111,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
}
ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
Timer* timer = Kernel::g_handle_table.Get<Timer>(handle);
SharedPtr<Timer> timer = Kernel::g_handle_table.Get<Timer>(handle);
if (timer == nullptr)
return InvalidHandle(ErrorModule::Kernel);
@ -125,7 +125,7 @@ ResultCode SetTimer(Handle handle, s64 initial, s64 interval) {
}
ResultCode CancelTimer(Handle handle) {
Timer* timer = Kernel::g_handle_table.Get<Timer>(handle);
SharedPtr<Timer> timer = Kernel::g_handle_table.Get<Timer>(handle);
if (timer == nullptr)
return InvalidHandle(ErrorModule::Kernel);