mirror of
https://github.com/libretro/parallel-gx1.git
synced 2026-11-07 04:26:01 -10:00
retro_run runs one video frame and the frontend paces it, so the core no longer paces itself: - The speed limiter is gone: CoreTiming::Throttle and its host-time targets, VI skip, the presenter's presentation-time wait, PrecisionTimer, PerformanceMetrics/PerformanceTracker, and the emulation speed, precision timing, rush/smooth presentation and VI skip settings and core options. The Dolphin IOS device reports 100% and ignores speed limits a guest asks for. - Common/FrameClock.c (C89) counts retro_run calls. Background threads that acted every so many milliseconds wait for a number of frames instead: real-Wiimote pool upkeep, scanning, write tests and reconnect retries, USB scanning, the USB Gecko and GBA link listeners, the BBA read thread, memory card flushing and the WC24 scheduler. Shutdown wakes every waiter. - Waits that polled or timed out now block until signalled: dual-core boot, PauseAndLock in the GPU loop, CPU thread jobs, shader compilation progress, BlockingLoop and ParallelFor setup and teardown. - Bluetooth passthrough submits transfers straight to libusb; the output worker and its timed sleep are deleted, HCI command timeouts count emulated time, and blocking firmware commands wait for the adapter's events. - Real Wiimote reports go out when produced; delayed ones carry a frame number. - Common::Flag sits on retro_atomic. - Deleted: SleepCurrentThread, YieldCPU, Common::SleepUntil, Event::WaitFor, BlockingLoop::WaitYield, timer resolution changes, the play-time tracker, Host_YieldToUI, FrameTiming::ThrottleFrame leftovers and the never-used DO_WAIT_FOR_WIIMOTES mode.
86 lines
1.6 KiB
C++
86 lines
1.6 KiB
C++
// Copyright 2008 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "Common/Thread.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#include <processthreadsapi.h>
|
|
#else
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#ifdef __APPLE__
|
|
#include <mach/mach.h>
|
|
#elif defined BSD4_4 || defined __FreeBSD__ || defined __OpenBSD__
|
|
#include <pthread_np.h>
|
|
#elif defined __NetBSD__
|
|
#include <sched.h>
|
|
#elif defined __HAIKU__
|
|
#include <OS.h>
|
|
#endif
|
|
|
|
#include <rthreads/rthreads.h>
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
namespace Common
|
|
{
|
|
int CurrentThreadId()
|
|
{
|
|
#ifdef _WIN32
|
|
return GetCurrentThreadId();
|
|
#elif defined __APPLE__
|
|
return mach_thread_self();
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
void SetCurrentThreadName(const char* name)
|
|
{
|
|
sthread_setname(name);
|
|
}
|
|
|
|
#ifndef _WIN32
|
|
|
|
std::tuple<void*, size_t> GetCurrentThreadStack()
|
|
{
|
|
void* stack_addr;
|
|
size_t stack_size;
|
|
|
|
pthread_t self = pthread_self();
|
|
|
|
#ifdef __APPLE__
|
|
stack_size = pthread_get_stacksize_np(self);
|
|
stack_addr = reinterpret_cast<u8*>(pthread_get_stackaddr_np(self)) - stack_size;
|
|
#elif defined __OpenBSD__
|
|
stack_t stack;
|
|
pthread_stackseg_np(self, &stack);
|
|
|
|
stack_addr = reinterpret_cast<u8*>(stack.ss_sp) - stack.ss_size;
|
|
stack_size = stack.ss_size;
|
|
#else
|
|
pthread_attr_t attr;
|
|
|
|
#ifdef __FreeBSD__
|
|
pthread_attr_init(&attr);
|
|
pthread_attr_get_np(self, &attr);
|
|
#else
|
|
// Linux and NetBSD
|
|
pthread_getattr_np(self, &attr);
|
|
#endif
|
|
|
|
pthread_attr_getstack(&attr, &stack_addr, &stack_size);
|
|
|
|
pthread_attr_destroy(&attr);
|
|
#endif
|
|
|
|
return std::make_tuple(stack_addr, stack_size);
|
|
}
|
|
|
|
#endif
|
|
|
|
} // namespace Common
|