Skip to content

Commit

Permalink
Merge pull request #3889 from Sonicadvance1/refactor_frontend_exithan…
Browse files Browse the repository at this point in the history
…dler

FEXCore: Refactor ExitHandler slightly
  • Loading branch information
Sonicadvance1 authored Jul 25, 2024
2 parents 1fe497d + ce8bc9d commit 380ba0a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FEXCore/Source/Interface/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ void ContextImpl::ExecutionThread(FEXCore::Core::InternalThreadState* Thread) {
Thread->ExitReason = FEXCore::Context::ExitReason::EXIT_SHUTDOWN;

if (CustomExitHandler) {
CustomExitHandler(Thread->ThreadManager.TID, Thread->ExitReason);
CustomExitHandler(Thread, Thread->ExitReason);
}
}

Expand Down
2 changes: 1 addition & 1 deletion FEXCore/include/FEXCore/Core/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ using CodeRangeInvalidationFn = std::function<void(uint64_t start, uint64_t Leng
using CustomCPUFactoryType = std::function<fextl::unique_ptr<CPU::CPUBackend>(Context*, Core::InternalThreadState* Thread)>;
using CustomIREntrypointHandler = std::function<void(uintptr_t Entrypoint, IR::IREmitter*)>;

using ExitHandler = std::function<void(uint64_t ThreadId, ExitReason)>;
using ExitHandler = std::function<void(Core::InternalThreadState* Thread, ExitReason)>;

using AOTIRCodeFileWriterFn = std::function<void(const fextl::string& fileid, const fextl::string& filename)>;
using AOTIRLoaderCBFn = std::function<int(const fextl::string&)>;
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/FEXLoader/FEXLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ int main(int argc, char** argv, char** const envp) {

// There might already be an exit handler, leave it installed
if (!CTX->GetExitHandler()) {
CTX->SetExitHandler([&](uint64_t thread, FEXCore::Context::ExitReason reason) {
CTX->SetExitHandler([&](FEXCore::Core::InternalThreadState* Thread, FEXCore::Context::ExitReason reason) {
if (reason != FEXCore::Context::ExitReason::EXIT_DEBUG) {
ShutdownReason = reason;
SyscallHandler->TM.Stop();
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/LinuxEmulation/LinuxSyscalls/GdbServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ GdbServer::GdbServer(FEXCore::Context::Context* ctx, FEX::HLE::SignalDelegator*
// Pass all signals by default
std::fill(PassSignals.begin(), PassSignals.end(), true);

ctx->SetExitHandler([this](uint64_t ThreadId, FEXCore::Context::ExitReason ExitReason) {
ctx->SetExitHandler([this](FEXCore::Core::InternalThreadState* Thread, FEXCore::Context::ExitReason ExitReason) {
if (ExitReason == FEXCore::Context::ExitReason::EXIT_DEBUG) {
this->Break(SIGTRAP);
}
Expand Down

0 comments on commit 380ba0a

Please sign in to comment.