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 failure to join or detach threads causing rare shutdown termination #2077

Merged

Conversation

RyeMutt
Copy link
Contributor

@RyeMutt RyeMutt commented Jul 21, 2024

This fixes a behavior where LLThreads were never detached or joined and could result in a crash on shutdown in rare instances .

Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

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

Thank you!

@akleshchev akleshchev merged commit 8666863 into secondlife:develop Aug 1, 2024
10 of 12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2024
@@ -269,6 +269,7 @@ void LLThread::shutdown()
mStatus = STOPPED;
return;
}
delete mThreadp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather see mThreadp be a std::unique_ptr<std::thread>, with a reset() call here and in start().

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, that's probably outside of a 'contribution' work, I will do an issue for that later.

@@ -299,6 +300,7 @@ void LLThread::start()
{
mThreadp = new std::thread(std::bind(&LLThread::threadRun, this));
mNativeHandle = mThreadp->native_handle();
mThreadp->detach();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that we have explicit logic to wait for thread termination, but time out and forcibly kill the thread, this makes sense, yes. In effect we manually "try to join()."

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants