Skip to content

[WIP]: Threading (macOS): implement set_name #96

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

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

Phatcat
Copy link
Contributor

@Phatcat Phatcat commented Apr 28, 2025

A name cannot be set directly on another thread, it can only be set on itself, but it can be staged as a self instruct and send it off with a signal handler to another thread. This can be used for reporting back on the status of the request. This is needed in order to achieve unity where the function throws an error if it fails; we need feedback to know if it failed.

Sadly not as direct or controlled as on windows/linux, but it's possible. Removing the check can result in a bad read during a race condition.
The tester for instance is one such case as it doesn't give the scheduler enough time to process the request but instead immediately requesting a get_name and failing - give it 1 microsecond or allow the flag to report back and it passes, so it's not that mac doesn't want to set the name, it just wants to do it on it's own accord...

Screenshot 2025-04-28 at 15 09 12

@Phatcat Phatcat changed the title [macOS] Threading: implement set_affinity and set_name [macOS] Threading: implement set_name Apr 28, 2025
@Phatcat Phatcat force-pushed the thread branch 6 times, most recently from 6f952de to 08260f5 Compare April 28, 2025 23:10
@Phatcat Phatcat changed the title [macOS] Threading: implement set_name [RFC]: (macOS) Threading: implement set_name Apr 30, 2025
@Phatcat Phatcat changed the title [RFC]: (macOS) Threading: implement set_name [RFC]: Threading (macOS): implement set_name Apr 30, 2025
@Phatcat Phatcat changed the title [RFC]: Threading (macOS): implement set_name [WIP]: Threading (macOS): implement set_name Apr 30, 2025
@Phatcat Phatcat marked this pull request as draft April 30, 2025 13:29
@Phatcat Phatcat force-pushed the thread branch 2 times, most recently from daf94c0 to c298ea9 Compare May 7, 2025 19:57
Macos has affinity requesting if using the policy for it, there is no dictating to the threads, it's only requesting.

Create a signal handler with a feedback flag and yield until we're sure the name is set (probably only needed for the unit_test because it doesn't give the mac thread scheduler a chance)
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