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

Implement C++ <thread> #4

Open
kammce opened this issue Jun 9, 2024 · 0 comments
Open

Implement C++ <thread> #4

kammce opened this issue Jun 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kammce
Copy link
Member

kammce commented Jun 9, 2024

To biggest issue with C++ thread library for embedded systems is the inability to support stack size. So we need to come up with a way to support stack size selection and still use the current API. C++ is working to add stack_hint and name to threads which will allow whatever workaround we find to be obsolete once it is in and the compilers support it. But until then, we should find a work around.

One idea, create a sort of array of structs that have a function pointer and a stack size. When thread is used it will check the list for a stack size. If none are present then it will use some default stack size. This would be our of band from the thread library. It would be im hal::freertos.

Or maybe some scoped stack hint object that changes a global (or thread local) stack size value that is then applied to the thread when it starts. Like:

{
  stack_size size(1024);
  std::thread my_thread(f); // stack size is 1024
} // Stack size returns to default amount. 

Maybe this is fine? Some investigation is required.

@kammce kammce added the enhancement New feature or request label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant