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

sched/pthread: detached thread should destroy the join info #12106

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

anchao
Copy link
Contributor

@anchao anchao commented Apr 9, 2024

Summary

sched/pthread: detached thread should destroy the join info

In order to ensure the detached thread obtain the correct return value from pthread_join()/pthread_cancel(), the detached thread will create joininfo to save the detached status after thread destroyed. If there are too many of detached threads in the process group, the joininfo will consume too much memory. This is not friendly to embedded MCU devices.
This commit keep the semantics as #11898 was introduced, will no longer save joininfo for detached threads to avoid wasting memory.

Impact

Fix issue #12096

Testing

ostest / ci-check

In order to ensure the detached thread obtain the correct return
value from pthread_join()/pthread_cancel(), the detached thread
will create joininfo to save the detached status after thread
destroyed.  If there are too many of detached threads in the
process group, the joininfo will consume too much memory.
This is not friendly to embedded MCU devices.
This commit keep the semantics as apache#11898 was introduced,
will no longer save joininfo for detached threads to avoid wasting memory.

Signed-off-by: chao an <anchao@lixiang.com>
anchao added a commit to anchao/nuttx-apps that referenced this pull request Apr 9, 2024
…uld return EINVAL, not ESRCH"

This reverts commit 69e497f.

In order to ensure the detached thread obtain the correct return
value from pthread_join()/pthread_cancel(), the detached thread
will create joininfo to save the detached status after thread
destroyed.  If there are too many of detached threads in the
process group, the joininfo will consume too much memory.
This is not friendly to embedded MCU devices.
This commit keep the semantics as #11898 was introduced,
will no longer save joininfo for detached threads to avoid wasting memory.

Refer PR:
apache/nuttx#12106

Signed-off-by: chao an <anchao@lixiang.com>
@anchao
Copy link
Contributor Author

anchao commented Apr 9, 2024

Depends on apache/nuttx-apps#2353

xiaoxiang781216 pushed a commit to apache/nuttx-apps that referenced this pull request Apr 9, 2024
…uld return EINVAL, not ESRCH"

This reverts commit 69e497f.

In order to ensure the detached thread obtain the correct return
value from pthread_join()/pthread_cancel(), the detached thread
will create joininfo to save the detached status after thread
destroyed.  If there are too many of detached threads in the
process group, the joininfo will consume too much memory.
This is not friendly to embedded MCU devices.
This commit keep the semantics as #11898 was introduced,
will no longer save joininfo for detached threads to avoid wasting memory.

Refer PR:
apache/nuttx#12106

Signed-off-by: chao an <anchao@lixiang.com>
@xiaoxiang781216 xiaoxiang781216 merged commit 09e5dca into apache:master Apr 9, 2024
21 of 26 checks passed
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.

Programe exited after call pthread_completejoin() many times on ESP32
3 participants