mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
rsx: fix potential hang during thread close
This commit is contained in:
parent
cc0d7c5985
commit
2f414f96bf
3 changed files with 7 additions and 4 deletions
|
@ -41,6 +41,8 @@ void GSRender::on_exit()
|
||||||
{
|
{
|
||||||
if (m_frame)
|
if (m_frame)
|
||||||
{
|
{
|
||||||
|
m_frame->disable_wm_event_queue();
|
||||||
|
m_frame->clear_wm_events();
|
||||||
m_frame->delete_context(m_context);
|
m_frame->delete_context(m_context);
|
||||||
m_context = nullptr;
|
m_context = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ namespace rsx
|
||||||
vblank_count = 0;
|
vblank_count = 0;
|
||||||
|
|
||||||
// TODO: exit condition
|
// TODO: exit condition
|
||||||
while (!Emu.IsStopped())
|
while (!Emu.IsStopped() && !m_rsx_thread_exiting)
|
||||||
{
|
{
|
||||||
if (get_system_time() - start_time > vblank_count * 1000000 / 60)
|
if (get_system_time() - start_time > vblank_count * 1000000 / 60)
|
||||||
{
|
{
|
||||||
|
@ -389,7 +389,7 @@ namespace rsx
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Emu.IsPaused())
|
while (Emu.IsPaused() && !m_rsx_thread_exiting)
|
||||||
std::this_thread::sleep_for(10ms);
|
std::this_thread::sleep_for(10ms);
|
||||||
|
|
||||||
std::this_thread::sleep_for(1ms); // hack
|
std::this_thread::sleep_for(1ms); // hack
|
||||||
|
@ -772,6 +772,7 @@ namespace rsx
|
||||||
|
|
||||||
void thread::on_exit()
|
void thread::on_exit()
|
||||||
{
|
{
|
||||||
|
m_rsx_thread_exiting = true;
|
||||||
if (m_vblank_thread)
|
if (m_vblank_thread)
|
||||||
{
|
{
|
||||||
m_vblank_thread->join();
|
m_vblank_thread->join();
|
||||||
|
@ -1618,7 +1619,7 @@ namespace rsx
|
||||||
|
|
||||||
memset(display_buffers, 0, sizeof(display_buffers));
|
memset(display_buffers, 0, sizeof(display_buffers));
|
||||||
|
|
||||||
m_used_gcm_commands.clear();
|
m_rsx_thread_exiting = false;
|
||||||
|
|
||||||
on_init_rsx();
|
on_init_rsx();
|
||||||
start_thread(fxm::get<GSRender>());
|
start_thread(fxm::get<GSRender>());
|
||||||
|
|
|
@ -209,6 +209,7 @@ namespace rsx
|
||||||
std::shared_ptr<thread_ctrl> m_vblank_thread;
|
std::shared_ptr<thread_ctrl> m_vblank_thread;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
atomic_t<bool> m_rsx_thread_exiting{false};
|
||||||
std::stack<u32> m_call_stack;
|
std::stack<u32> m_call_stack;
|
||||||
std::array<push_buffer_vertex_info, 16> vertex_push_buffers;
|
std::array<push_buffer_vertex_info, 16> vertex_push_buffers;
|
||||||
std::vector<u32> element_push_buffer;
|
std::vector<u32> element_push_buffer;
|
||||||
|
@ -316,7 +317,6 @@ namespace rsx
|
||||||
u64 vblank_count;
|
u64 vblank_count;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::set<u32> m_used_gcm_commands;
|
|
||||||
bool invalid_command_interrupt_raised = false;
|
bool invalid_command_interrupt_raised = false;
|
||||||
bool sync_point_request = false;
|
bool sync_point_request = false;
|
||||||
bool in_begin_end = false;
|
bool in_begin_end = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue