Skip to content

Add some extensions to pthread for armv6k-nintendo-3ds#5

Merged
Meziu merged 1 commit intoMeziu:masterfrom
AzureMarker:feature/pthread-extensions
Feb 10, 2022
Merged

Add some extensions to pthread for armv6k-nintendo-3ds#5
Meziu merged 1 commit intoMeziu:masterfrom
AzureMarker:feature/pthread-extensions

Conversation

@AzureMarker
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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