Skip to content

Fix joining thread on serial disconnect#710

Merged
1Blademaster merged 1 commit intorelease-alpha-0.1.10from
alpha-0.1.10/709-cannot-join-thread-on-serial-disconnect
Sep 23, 2025
Merged

Fix joining thread on serial disconnect#710
1Blademaster merged 1 commit intorelease-alpha-0.1.10from
alpha-0.1.10/709-cannot-join-thread-on-serial-disconnect

Conversation

@1Blademaster
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the thread joining logic in the stopAllThreads method to avoid potential deadlocks by ensuring threads don't try to join themselves. The change replaces individual thread join calls with a loop that checks if each thread exists, is alive, and is not the current thread before attempting to join it.

Key Changes:

  • Replaced multiple individual thread.join() calls with a single loop
  • Added current thread detection to prevent self-joining
  • Added null and alive checks for thread safety

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@1Blademaster 1Blademaster changed the title Join all threads except current Fix joining thread on serial disconnect Sep 21, 2025
Copy link
Copy Markdown
Contributor

@NexInfinite NexInfinite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if thread is not None and thread.is_alive() and thread is not this_thread: I love how easy python is to read compared to JS, I miss python PRs. Codes good tho 👍🏻

@1Blademaster 1Blademaster merged commit f4a305e into release-alpha-0.1.10 Sep 23, 2025
7 checks passed
@1Blademaster 1Blademaster deleted the alpha-0.1.10/709-cannot-join-thread-on-serial-disconnect branch September 23, 2025 17:19
1Blademaster added a commit that referenced this pull request Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants