2020-04-08 09:21:35 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-04-08 09:21:35 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
#include "os_thread_manager_types.hpp"
|
|
|
|
#include "os_resource_manager.hpp"
|
|
|
|
|
|
|
|
namespace ams::os::impl {
|
|
|
|
|
|
|
|
constexpr inline s32 CoreAffinityMaskBitWidth = BITSIZEOF(u64);
|
|
|
|
|
|
|
|
ALWAYS_INLINE ThreadManager &GetThreadManager() {
|
|
|
|
return GetResourceManager().GetThreadManager();
|
|
|
|
}
|
|
|
|
|
|
|
|
ALWAYS_INLINE ThreadType *GetCurrentThread() {
|
|
|
|
return GetThreadManager().GetCurrentThread();
|
|
|
|
}
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
#if !defined(AMS_OS_IMPL_USE_PTHREADS)
|
2021-10-04 19:33:09 +00:00
|
|
|
ALWAYS_INLINE NativeHandle GetCurrentThreadHandle() {
|
2022-03-06 20:08:20 +00:00
|
|
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
2020-04-08 09:21:35 +00:00
|
|
|
return ::threadGetCurHandle();
|
2022-03-06 20:08:20 +00:00
|
|
|
#else
|
|
|
|
return GetCurrentThread()->native_handle;
|
|
|
|
#endif
|
2020-04-08 09:21:35 +00:00
|
|
|
}
|
2022-03-06 20:08:20 +00:00
|
|
|
#endif
|
2020-04-08 09:21:35 +00:00
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
void SetupThreadObjectUnsafe(ThreadType *thread, void *platform, ThreadFunction function, void *arg, void *stack, size_t stack_size, s32 priority);
|
2020-04-08 09:21:35 +00:00
|
|
|
|
|
|
|
}
|