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 some extensions to pthread for armv6k-nintendo-3ds #5

Merged
merged 1 commit into from
Feb 10, 2022

Conversation

AzureMarker
Copy link

The pthread_attr_t type can have priority and affinity values set.
pthread_getpriority returns the priority of the current thread.

These are needed to enable std thread support. std can't link directly with libctru so we go through pthread as an intermediate interface.

The pthread_attr_t type can have priority and affinity values set.
pthread_getpriority returns the priority of the current thread.

These are needed to enable std thread support. std can't link directly
with libctru so we go through pthread as an intermediate interface.
@Meziu
Copy link
Owner

Meziu commented Feb 10, 2022

No, we shouldn’t define functions not normally found in standard declarations.
The pthread_attr_t type has 56 bytes of available memory, can’t we use pointer math on that instead? We could put default values when initializing the struct (in pthread_attr_init) and otherwise change them via pointer math or an array with as in the std directly. It doesn’t look good, but at least we won’t be breaking this rule.

Default values could be: the spawning thread’s priority, and the normal core (0).

@AzureMarker
Copy link
Author

AzureMarker commented Feb 10, 2022

That sounds really cursed and I doubt std will merge that. That's tying std even closer to the implementation details.

There's other pthread functions only found on certain platforms in the libc crate already, so I think this is somewhat normal.

@Meziu
Copy link
Owner

Meziu commented Feb 10, 2022

I really don’t like both ideas honestly… let’s go with this one anyways. It isn’t directly tied to devkitPRO, but we are putting ourselves in a weird position. Let’s go on with this for now.

@Meziu Meziu merged commit 0c2a86d into Meziu:master Feb 10, 2022
@AzureMarker AzureMarker deleted the feature/pthread-extensions branch February 11, 2022 01:48
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