mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-10-30 11:57:51 +00:00
Core: Fix tests.
This commit is contained in:
parent
00b09de3d9
commit
9cafb0d912
3 changed files with 5 additions and 2 deletions
|
@ -62,8 +62,7 @@ void SetCurrentThreadPriority(ThreadPriority new_priority) {
|
||||||
void SetCurrentThreadPriority(ThreadPriority new_priority) {
|
void SetCurrentThreadPriority(ThreadPriority new_priority) {
|
||||||
pthread_t this_thread = pthread_self();
|
pthread_t this_thread = pthread_self();
|
||||||
|
|
||||||
const auto scheduling_type =
|
const auto scheduling_type = SCHED_OTHER;
|
||||||
new_priority != ThreadPriority::Critical ? SCHED_OTHER : SCHED_FIFO;
|
|
||||||
s32 max_prio = sched_get_priority_max(scheduling_type);
|
s32 max_prio = sched_get_priority_max(scheduling_type);
|
||||||
s32 min_prio = sched_get_priority_min(scheduling_type);
|
s32 min_prio = sched_get_priority_min(scheduling_type);
|
||||||
u32 level = std::max(static_cast<u32>(new_priority) + 1, 4U);
|
u32 level = std::max(static_cast<u32>(new_priority) + 1, 4U);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include "common/atomic_ops.h"
|
||||||
#include "common/uint128.h"
|
#include "common/uint128.h"
|
||||||
#include "common/x64/native_clock.h"
|
#include "common/x64/native_clock.h"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
@ -21,9 +22,11 @@ std::array<s64, 5> delays{};
|
||||||
|
|
||||||
std::bitset<CB_IDS.size()> callbacks_ran_flags;
|
std::bitset<CB_IDS.size()> callbacks_ran_flags;
|
||||||
u64 expected_callback = 0;
|
u64 expected_callback = 0;
|
||||||
|
std::mutex control_mutex;
|
||||||
|
|
||||||
template <unsigned int IDX>
|
template <unsigned int IDX>
|
||||||
void HostCallbackTemplate(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) {
|
void HostCallbackTemplate(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) {
|
||||||
|
std::unique_lock<std::mutex> lk(control_mutex);
|
||||||
static_assert(IDX < CB_IDS.size(), "IDX out of range");
|
static_assert(IDX < CB_IDS.size(), "IDX out of range");
|
||||||
callbacks_ran_flags.set(IDX);
|
callbacks_ran_flags.set(IDX);
|
||||||
REQUIRE(CB_IDS[IDX] == user_data);
|
REQUIRE(CB_IDS[IDX] == user_data);
|
||||||
|
|
Loading…
Reference in a new issue