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

App::CreateThread #133

Merged
merged 1 commit into from
Aug 31, 2024
Merged

App::CreateThread #133

merged 1 commit into from
Aug 31, 2024

Conversation

shuhaowu
Copy link
Contributor

@shuhaowu shuhaowu commented Aug 30, 2024

Instead of letting Thread be created outside of the app, we now force the Thread to be created by the App::CreateThread factory method. This allows us to better control lifetime and sets up the stage to possibly eliminate the weak_ptr situation with the trace aggregator if the Thread is not longer a shared_ptr.

Issues:

  • Thread can be retained by the user as a shared_ptr which means it might not go out of scope before App does.
    • An issue because after thread finishes executing, it needs to notify the TraceAggregator which could have gone out of scope with the App.
  • Technically there's still an issue where App goes out of scope before the Thread joins. The Thread currently would just be detached and it will try to notify the TraceAggregator when it finishes.

Instead of letting `Thread` be created outside of the app, we now force
the `Thread` to be created by the `App::CreateThread` factory method.
This allows us to better control lifetime and sets up the stage to
possibly eliminate the weak_ptr situation with the trace aggregator if
the Thread is not longer a shared_ptr.
@shuhaowu shuhaowu merged commit 4450f9c into master Aug 31, 2024
3 checks passed
@shuhaowu shuhaowu deleted the thread-refactor branch August 31, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant