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

Add ScopedJobThreadPtr class to be used with JobThread #4275

Open
wants to merge 1 commit into
base: 25.lts.1+
Choose a base branch
from

Conversation

alexanderbobrovnik
Copy link
Collaborator

@alexanderbobrovnik alexanderbobrovnik commented Oct 17, 2024

b/372515171

}
}

void JobThread::JoinThread() {
Copy link
Contributor

@xiaomings xiaomings Oct 17, 2024

Choose a reason for hiding this comment

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

We are adding a new convention to JobThread, that JoinThread() has to be called prior to destruction.

We could handle this situation better by introducing a new class (e.g. JobThreadHolder) that holds an JobThread object, keeps itself valid before destroying the underlying JobThread. Once the new class is implemented, turn the dtor of JobThread into private and a friend of the new class, so other teammates won't accidentally wrap a JobThread into a std::unique_ptr<>.

We should then revert all previous changes that call ScheduleAndWait() before destroying the JobThread.

@alexanderbobrovnik alexanderbobrovnik changed the title Add explicit join thread to JobThread Add ScopedJobThreadPtr class to be used with JobThread Oct 22, 2024
@xiaomings
Copy link
Contributor

@borongc is it possible for you to help me review the part in this PR where all changes to Schedule() made during the scoped_ptr<> to unique_ptr<> migration is reverted?

starboard/shared/starboard/player/job_thread.h Outdated Show resolved Hide resolved
starboard/shared/starboard/player/job_thread.h Outdated Show resolved Hide resolved
starboard/shared/starboard/player/job_thread.h Outdated Show resolved Hide resolved
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.

2 participants