Skip to content

pthread: facilitate dynamically allocated thread stacks #31603

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

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented Jan 25, 2021

This change allows users to call pthread_create(3) with the pthread_attr_t argument equal to NULL, or with the pthread_attr_t argument specifying a NULL stack.

If either of the above to requirements are met, then a stack will be heap-allocated internally and freed again after the thread has terminated.

This helps the Zephyr implementation of pthread_create(3) become more compliant with the normative spec.

Fixes #25973

@github-actions github-actions bot added area: API Changes to public APIs area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test labels Jan 25, 2021
@cfriedt
Copy link
Member Author

cfriedt commented Jan 25, 2021

Had to recreate this PR from #29029 due to some repo issues in my fork.

@cfriedt cfriedt marked this pull request as draft January 25, 2021 22:22
@cfriedt cfriedt force-pushed the issue/25973/dynamic-stack-support-for-pthread-create branch 3 times, most recently from 8ed4bf4 to f46d695 Compare February 3, 2021 14:14
@carlocaione carlocaione requested review from carlocaione and removed request for andrewboie February 3, 2021 14:15
@cfriedt cfriedt force-pushed the issue/25973/dynamic-stack-support-for-pthread-create branch 3 times, most recently from 0df325f to 286714e Compare February 8, 2021 13:26
This change allows users to call pthread_create(3) with
the pthread_attr_t argument equal to NULL, or with the
pthread_attr_t argument specifying a NULL stack but a
custom stack size.

If either of the above to requirements are met, then
a stack will be heap-allocated internally and
freed again after the thread has terminated.

This makes the Zephyr implementation of pthread_create(3)
more compliant with the normative spec.

Fixes zephyrproject-rtos#25973

Signed-off-by: Christopher Friedt <[email protected]>
Tests for dynamically allocated POSIX thread stacks.

Fixes zephyrproject-rtos#25973

Signed-off-by: Christopher Friedt <[email protected]>
@cfriedt cfriedt force-pushed the issue/25973/dynamic-stack-support-for-pthread-create branch from 286714e to 77d9292 Compare February 10, 2021 14:18
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Apr 12, 2021
@cfriedt cfriedt removed the Stale label Apr 14, 2021
@cfriedt
Copy link
Member Author

cfriedt commented Apr 14, 2021

Still working on an item that this depends on. Has to do with treating user thread stacks as dynamic objects to avoid triggering the mmu / mpu.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 14, 2021
@cfriedt cfriedt removed the Stale label Jul 14, 2021
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Sep 13, 2021
@github-actions github-actions bot closed this Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lib: posix: dynamic stack support for pthread_create()
1 participant