-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
[core_bind] Add Thread::is_alive
. Replace is_active
with is_started
to align with core/os/Thread API.
#53455
Conversation
I think if it's implemented in |
If you're referring to core/os/thread, then Though, it appears that core/os |
I think that was an oversight when |
|
@RandomShaper Do you think implementing I'm heavily against doing this because of the complexity, but perhaps there's a simple solution I'm missing. Also, as far as I know, this doesn't currently have a use in core. |
db0b862
to
1404488
Compare
is_executing
to Threadis_alive
to Thread. Replace is_active
with is_started
to align with core/os Thread API.
1404488
to
4c5efec
Compare
…arted`. Replacing `is_active` resolves an API discrepancy between core_bind Thread and core/os Thread.
4c5efec
to
f28c677
Compare
is_alive
to Thread. Replace is_active
with is_started
to align with core/os Thread API.Thread::is_alive
. Replace is_active
with is_started
to align with core/os/Thread API.
I agree with you; probably too involved to be worthy when the C++ side has been good without it so far. |
The only potential concern now is the exotic looking commit message, because of the square bracketed tag. Let's hear @akien-mga's opinion on that. |
Exotic indeed in our codebase, but we don't have a fixed convention and it does convey important information here (C++ |
Thanks! |
I'll put a little more consideration into commit names in the future 😅 |
This adds the function
is_alive
to Thread. This is a usability improvement allowing users to check if a thread is still doing work. This helps resolve confusion aroundis_active
(renamed tois_started
), which was reasonably expected to behave asis_alive
.The current workaround to this is to create a
finished_executing
flag for each thread, set tofalse
beforethread.start
and set totrue
at the end of the threaded function.If/when this gets approved, I'll open a branch for 3.x that doesn't break compatibility.