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

New pthread APIs in devkitARM / 3DS ? #26

Open
ian-h-chamberlain opened this issue Apr 14, 2023 · 2 comments
Open

New pthread APIs in devkitARM / 3DS ? #26

ian-h-chamberlain opened this issue Apr 14, 2023 · 2 comments

Comments

@ian-h-chamberlain
Copy link

Hello! I noticed with the latest devkitARM update (r60-9) that newlib was updated to 4.3.0 and there appears to be a full pthread API included as part of devkitPro/buildscripts@cd5e224

As far as I can tell, the syscalls used by the pthread implementation are not actually implemented anywhere, so none of the pthread_* functions actually work, which is fine - however, it does seem like on the 3DS it would be possible to implement some of the functionality using libctru calls and get a mostly-working pthread implementation.

In light of this, I had a few questions about the new changes and any future plans for them:

  1. Is there an intention to support pthreads on the 3DS?
    • If so, would the syscalls be implemented in libctru or perhaps somewhere else? Are the maintainers looking for help implementing this?
    • If not, is this a supported scenario (for users that are willing to write syscalls themselves)?
  2. Will the patch linked above eventually be delivered to the devkitARM branch of this repo? If not, is there somewhere else it lives that can be used for reference, besides just the buildscripts repo as a big diff?

Thanks in advance! I was excited to see these changes pulled down when I upgraded, but I wanted to set my expectations and see what, if any plans you all had for these APIs.

@WinterMute
Copy link
Member

Shush. You weren't supposed to notice that yet :P

There is an intention to support pthreads on 3DS and, yes that support will be in libctru. We're not really looking for help with the implementation tbh but if you need something in particular we're generally willing to listen.

The devkitARM branch has now been deleted after quite a bit of work to consolidate the devkitA64 and devkitARM patchsets while updating to latest newlib snapshot in order to ease future maintenance and work towards feature parity. These changes now live at https://github.com/devkitPro/newlib/tree/devkitPro

@ian-h-chamberlain
Copy link
Author

There is an intention to support pthreads on 3DS and, yes that support will be in libctru.

Awesome, that's great news to hear, thank you!

but if you need something in particular we're generally willing to listen.

I think the only thing that came to mind when I first started looking at the implementation was that it would be nice to have some way to set CPU affinity / priority at thread creation time. It looks like __syscall_thread_create doesn't have access to everything in the pthread_attr_t* used to create the thread (just stacksize and stackaddr).

It would be great if we were able to use APIs like phread_attr_setschedparam and pthread_attr_setaffinity_np to change thread properties before creating a thread (particularly CPU affinity, since it seems setting after thread creation hasn't been supported for some time).

Clearly this is still under active development so I'll try not to get ahead of myself, but thank you for your work and I look forward to seeing further development on this front! 🚀

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

No branches or pull requests

2 participants