Example #1
0
/// Synchronize to an OS service
static Result SendSyncRequest(Handle handle) {
    Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);

    _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
    DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str());

    bool wait = false;
    Result res = object->SyncRequest(&wait);
    if (wait) {
        Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
    }

    return res;
}
Example #2
0
/// Synchronize to an OS service
static Result SendSyncRequest(Handle handle) {
    // TODO(yuriks): ObjectPool::Get tries to check the Object type, which fails since this is a generic base Object,
    // so we are forced to use GetFast and manually verify the handle.
    if (!Kernel::g_object_pool.IsValid(handle)) {
        return InvalidHandle(ErrorModule::Kernel).raw;
    }
    Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);

    _assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
    DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str());

    ResultVal<bool> wait = object->SyncRequest();
    if (wait.Succeeded() && *wait) {
        Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
    }

    return wait.Code().raw;
}