You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is similar to the existing read method, and I think it is a little nicer to use than copy_to_ptr in simpler cases.
(Also I'm not sure that the pid address write in reap_thread() is correct since I think it's supposed to write a pointer, not a pid_t, but for now I'm leaving this the same as it was before.)
(Also I'm not sure that the pid address write in reap_thread() is correct since I think it's supposed to write a pointer, not a pid_t, but for now I'm leaving this the same as it was before.)
I'm pretty sure it writes a pid_t. From man set_tid_address:
When set_child_tid is set, the very first thing the new thread does is to write its thread ID at this address.
...
When a thread whose clear_child_tid is not NULL terminates, then, if the thread is sharing memory with other threads, then 0 is written at the address specified in clear_child_tid and the kernel performs the following operation
(Also I'm not sure that the pid address write in reap_thread() is correct since I think it's supposed to write a pointer, not a pid_t, but for now I'm leaving this the same as it was before.)
I'm pretty sure it writes a pid_t. From man set_tid_address:
When set_child_tid is set, the very first thing the new thread does is to write its thread ID at this address.
...
When a thread whose clear_child_tid is not NULL terminates, then, if the thread is sharing memory with other threads, then 0 is written at the address specified in clear_child_tid and the kernel performs the following operation
Ah okay, I think I was getting confused by the prctl PR_GET_TID_ADDRESS, which writes the value of the ForeignPtr pointer (not the value pointed to by the ForeignPtr). I'll make a PR to try and add types here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is similar to the existing
readmethod, and I think it is a little nicer to use thancopy_to_ptrin simpler cases.(Also I'm not sure that the pid address write in
reap_thread()is correct since I think it's supposed to write a pointer, not apid_t, but for now I'm leaving this the same as it was before.)