2018-08-01 22:40:00 -04:00
|
|
|
// Copyright 2018 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "common/assert.h"
|
2018-08-28 12:30:33 -04:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
2018-08-01 22:40:00 -04:00
|
|
|
#include "core/hle/kernel/object.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2021-01-31 04:38:57 -05:00
|
|
|
Object::Object(KernelCore& kernel_)
|
|
|
|
: kernel{kernel_}, object_id{kernel_.CreateNewObjectID()}, name{"[UNKNOWN KERNEL OBJECT]"} {}
|
|
|
|
Object::Object(KernelCore& kernel_, std::string&& name_)
|
|
|
|
: kernel{kernel_}, object_id{kernel_.CreateNewObjectID()}, name{std::move(name_)} {}
|
2018-08-01 22:40:00 -04:00
|
|
|
Object::~Object() = default;
|
|
|
|
|
|
|
|
bool Object::IsWaitable() const {
|
|
|
|
switch (GetHandleType()) {
|
2018-12-03 22:50:16 -05:00
|
|
|
case HandleType::ReadableEvent:
|
2018-08-01 22:40:00 -04:00
|
|
|
case HandleType::Thread:
|
2018-12-04 19:08:56 -05:00
|
|
|
case HandleType::Process:
|
2018-08-01 22:40:00 -04:00
|
|
|
case HandleType::ServerPort:
|
|
|
|
case HandleType::ServerSession:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case HandleType::Unknown:
|
2021-01-31 04:38:57 -05:00
|
|
|
case HandleType::Event:
|
2018-12-03 22:50:16 -05:00
|
|
|
case HandleType::WritableEvent:
|
2018-08-01 22:40:00 -04:00
|
|
|
case HandleType::SharedMemory:
|
2019-03-13 03:09:27 -04:00
|
|
|
case HandleType::TransferMemory:
|
2018-08-01 22:40:00 -04:00
|
|
|
case HandleType::ResourceLimit:
|
|
|
|
case HandleType::ClientPort:
|
|
|
|
case HandleType::ClientSession:
|
2019-11-25 18:28:48 -05:00
|
|
|
case HandleType::Session:
|
2018-08-01 22:40:00 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
UNREACHABLE();
|
2018-12-18 20:52:32 -05:00
|
|
|
return false;
|
2018-08-01 22:40:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Kernel
|