File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed 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) const 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) const 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