-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
ThreadExt
is highly misleading
#30
Comments
Hi @CAD97! Thank you for your report. Let me answer.
To sum up: I'll add a check and then think of how we can use (and whether or not it will be enough and good enough) the existing Rust methods. |
iddm
added a commit
that referenced
this issue
Mar 16, 2023
This is a part of #30 We can't get another thread's ID if we didn't store it when it was created. As we don't have control over that, we can't properly implement the `ThreadExt::get_native_id()` for any thread which isn't current.
I have an idea of creating a separate structure called |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Specifically, because
ThreadExt::get_native_id
(and thus all of the other methods) doesn't get the native id, it gets the id of the current thread.As an example:
Or written another way:
Removing the extension trait or adding a check that
self == thread::current()
is required to not be giving actively misleading results.std::thread::JoinHandle
actually supports getting the raw OS handle oncfg(windows)
viaAsRawHandle::as_raw_handle
andcfg(unix)
viaJoinHandleExt::as_pthread_t
. Perhaps it's not completely unreasonable to suggest that we could get similar extension trait access to the OS handle forstd::thread::Thread
. Until we do, though,ThreadExt
is impossible to implement in the implied way of actually getting the data for the represented thread.The text was updated successfully, but these errors were encountered: