Merge pull request #2112 from LeandroLP23/fix/agc-profile-output-shutdown
fix(agc): stop the profile output at shutdown only if it was created
This commit is contained in:
commit
d70b899894
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
|
|
@ -135,14 +136,21 @@ private:
|
|||
std::thread worker;
|
||||
};
|
||||
|
||||
inline std::atomic<ProfileOutput*> createdProfileOutput{nullptr};
|
||||
|
||||
inline ProfileOutput& ProfileOutput_nid_no_patch() {
|
||||
static ProfileOutput output([](std::string_view text) {
|
||||
if (std::fwrite(text.data(), 1, text.size(), stderr) != text.size() || std::fflush(stderr) != 0)
|
||||
throw std::runtime_error("profile output write failed");
|
||||
});
|
||||
createdProfileOutput.store(&output, std::memory_order_release);
|
||||
return output;
|
||||
}
|
||||
|
||||
inline void StopProfileOutput_nid_no_patch() {
|
||||
if (auto* output = createdProfileOutput.load(std::memory_order_acquire)) output->Stop();
|
||||
}
|
||||
|
||||
template<typename... TArgs>
|
||||
void ProfilePrint_nid_no_patch(const char* format, TArgs... args) {
|
||||
ProfileOutput_nid_no_patch().Print(format, args...);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ void Driver::stop() {
|
|||
device.Reset();
|
||||
replacedDevices.clear();
|
||||
Graphics::ShutdownGuestBufferWorkers();
|
||||
ProfileOutput_nid_no_patch().Stop();
|
||||
StopProfileOutput_nid_no_patch();
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ if(BUILD_TESTING)
|
|||
if(WIN32)
|
||||
set_tests_properties(guest_video_out_wqhd_detection PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
add_test(NAME guest_video_out_wqhd_detection_no_vulkan COMMAND guest_video_out_wqhd_detection_tests)
|
||||
set_tests_properties(guest_video_out_wqhd_detection_no_vulkan PROPERTIES TIMEOUT 20 SKIP_RETURN_CODE 77
|
||||
ENVIRONMENT "VK_DRIVER_FILES=${CMAKE_CURRENT_BINARY_DIR}/missing_icd.json;VK_ICD_FILENAMES=${CMAKE_CURRENT_BINARY_DIR}/missing_icd.json"
|
||||
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue