File tree Expand file tree Collapse file tree 3 files changed +29
-14
lines changed Expand file tree Collapse file tree 3 files changed +29
-14
lines changed Original file line number Diff line number Diff line change @@ -3895,23 +3895,14 @@ bool Emulator::Quit(bool force_quit)
38953895
38963896void Emulator::CleanUp ()
38973897{
3898- // Signal threads
3899- if (auto rsx = g_fxo->try_get <rsx::thread>())
3900- {
3901- *static_cast <cpu_thread*>(rsx) = thread_state::aborting;
3902- }
3903-
3904- for (const auto & [type, data] : *g_fxo)
3898+ // Join threads
3899+ qt_events_aware_op (50 , [&]()
39053900 {
3906- if (type. thread_op )
3901+ if (!g_fxo-> is_init () )
39073902 {
3908- type. thread_op (data, thread_state::aborting) ;
3903+ return true ;
39093904 }
3910- }
39113905
3912- // Join threads
3913- qt_events_aware_op (50 , [&]()
3914- {
39153906 bool has_running = false ;
39163907
39173908 for (const auto & [type, data] : *g_fxo)
Original file line number Diff line number Diff line change @@ -45,8 +45,18 @@ gui_pad_thread::gui_pad_thread()
4545 m_thread = std::make_unique<named_thread<std::function<void ()>>>(" Gui Pad Thread" , [this ](){ run (); });
4646}
4747
48- gui_pad_thread::~gui_pad_thread ()
48+ gui_pad_thread& gui_pad_thread:: operator =(thread_state state) noexcept
4949{
50+ if (state == thread_state::aborting)
51+ {
52+ if (m_thread)
53+ {
54+ *m_thread = state;
55+ }
56+
57+ return *this ;
58+ }
59+
5060 // Join thread
5161 m_thread.reset ();
5262
@@ -63,6 +73,18 @@ gui_pad_thread::~gui_pad_thread()
6373 m_uinput_fd = -1 ;
6474 }
6575#endif
76+
77+ return *this ;
78+ }
79+
80+ gui_pad_thread::operator thread_state () const noexcept
81+ {
82+ return m_thread && *m_thread != thread_state::finished ? m_thread->operator thread_state () : thread_state::finished;
83+ }
84+
85+ gui_pad_thread::~gui_pad_thread ()
86+ {
87+ *this = thread_state::finished;
6688}
6789
6890void gui_pad_thread::update_settings (const std::shared_ptr<gui_settings>& settings)
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ class gui_pad_thread
1515{
1616public:
1717 gui_pad_thread ();
18+ gui_pad_thread& operator =(thread_state state) noexcept ;
19+ operator thread_state () const noexcept ;
1820 virtual ~gui_pad_thread ();
1921
2022 void update_settings (const std::shared_ptr<gui_settings>& settings);
You can’t perform that action at this time.
0 commit comments