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

Support for std::thread and std::this_thread #25569

Open
4 of 5 tasks
cfriedt opened this issue May 24, 2020 · 3 comments · May be fixed by #43729
Open
4 of 5 tasks

Support for std::thread and std::this_thread #25569

cfriedt opened this issue May 24, 2020 · 3 comments · May be fixed by #43729
Assignees
Labels
area: C++ Enhancement Changes/Updates/Additions to existing features

Comments

@cfriedt
Copy link
Member

cfriedt commented May 24, 2020

Is your enhancement proposal related to a problem? Please describe.
It would be nice for C++ applications to be able to use std::thread and std::this_thread.

Describe the solution you'd like
To be able to use use std::thread and std::this_thread. I can make a PR.

Describe alternatives you've considered
I recently created a PR to provide a sample for and to document the socketpair API (#25528) and was able to get threading working with a couple of defines and implementing std::thread::join().

I also needed nanosleep(2) for std::this_thread::sleep_for()

However, in #25528 it was only partial support for std::thread. There are a couple of additional modes that will need testing. I thought it better to make a separate PR to address C++ threading as a whole.

Additional context

See also

@cfriedt cfriedt added the Enhancement Changes/Updates/Additions to existing features label May 24, 2020
@cfriedt cfriedt self-assigned this Mar 13, 2022
cfriedt added a commit to cfriedt/zephyr that referenced this issue Apr 10, 2022
This commit adds support for std::thread and std::this_thread
when the configured C++ standard is >= C++11.

The implementation uses POSIX threads under the hood.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Apr 10, 2022
This commit adds tests for std::thread and std::this_thread.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Jul 13, 2023
This commit adds support for std::thread and std::this_thread
when the configured C++ standard is >= C++11.

The implementation uses POSIX threads under the hood.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Jul 13, 2023
This commit adds tests for std::thread and std::this_thread.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Aug 30, 2023
This commit adds support for std::thread and std::this_thread
when the configured C++ standard is >= C++11.

The implementation uses POSIX threads under the hood.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Aug 30, 2023
This commit adds tests for std::thread and std::this_thread.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Aug 30, 2023
This commit adds support for std::thread and std::this_thread
when the configured C++ standard is >= C++11.

The implementation uses POSIX threads under the hood.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
cfriedt added a commit to cfriedt/zephyr that referenced this issue Aug 30, 2023
This commit adds tests for std::thread and std::this_thread.

Fixes zephyrproject-rtos#25569

Signed-off-by: Christopher Friedt <[email protected]>
@MrMarteng
Copy link
Collaborator

I'd love to have this functionality on Zephyr!

@cfriedt
Copy link
Member Author

cfriedt commented Jun 29, 2024

@MrMarteng - we are one PR to the zephyr-sdk away. The change that adds C++ threads support was unfortunately reverted as there were a couple of gaps in testing, but you can (IIRC) still download SDK release 0.16.6 which should have the required features.

See zephyrproject-rtos/sdk-ng#751 for more info

@vhouriecosta-sc
Copy link

I would also love to see this feature on Zephyr. Do we have any ETA of when will this feature be rolled out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C++ Enhancement Changes/Updates/Additions to existing features
Projects
None yet
4 participants