Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user_interface::alloc_thread_bit() usage #10846

Merged
merged 1 commit into from Sep 13, 2021
Merged

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Sep 9, 2021

The reason it crashed is because enqueued task which releases thread bits never executed in RSX overlays code, user_interface class.
Aims to fix #10845

@elad335
Copy link
Contributor Author

elad335 commented Sep 9, 2021

Hmm maybe @Nekotekina can look into it later. This has many consequences in its current form.

@elad335
Copy link
Contributor Author

elad335 commented Sep 9, 2021

Fixed in a simpler way.

@elad335 elad335 changed the title Threads: Fix tasks queue after thread aborted Fix user_interface::alloc_thread_bit() usage Sep 9, 2021
@elad335 elad335 marked this pull request as ready for review September 9, 2021 19:25
@Nekotekina
Copy link
Member

From my limited debugging attempt, these parts of code aren't called at all if I ready then stop the emulator. Could be something else.

@Megamouse
Copy link
Contributor

I noticed 3 unknown threads dangling in VS. this PR seems to fix the issue.

@Megamouse
Copy link
Contributor

there's something fishy here. I think I know why

@Megamouse
Copy link
Contributor

found it

@Megamouse
Copy link
Contributor

See #10838

@elad335
Copy link
Contributor Author

elad335 commented Sep 10, 2021

Ok I'll elaborate, when Emu.Stop() is executed (can be executed at any given moment) all threads are notified with their state transitioning first to thread_state::aborting. In this state, enqueued thread tasks may or may not be executed. Previous alloc_thread_bit() usage assumed that the enqueued task is always executed.
After the thread has completely being terminated, its state transitions to either thread_state::errored (for errors) or thread_state::finished (normal termination). In those states, enqueued tasks are guaranteed to not be executed.

@elad335 elad335 force-pushed the unpause branch 2 times, most recently from add73a7 to 2b3ae27 Compare September 10, 2021 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash after trying to stop the emulation in Ready state
3 participants