nuttx-mirror/sched/group
chao an df30a1f8d3 sched/pthread/join: refactor pthread join to support join task
1. add support to join main task

| static pthread_t self;
|
| static void *join_task(void *arg)
| {
|   int ret;
|   ret = pthread_join(self, NULL);          <---  /* Fix Task could not be joined */
|   return NULL;
| }
|
| int main(int argc, char *argv[])
| {
|   pthread_t thread;
|
|   self = pthread_self();
|
|   pthread_create(&thread, NULL, join_task, NULL);
|   sleep(1);
|
|   pthread_exit(NULL);
|   return 0;
| }

2. Detach active thread will not alloc for additional join, just update the task flag.
3. Remove the return value waiting lock logic (data_sem),
   the return value will be stored in the waiting tcb.
4. Revise the return value of pthread_join(), consistent with linux
   e.g:
       Joining a detached and canceled thread should return EINVAL, not ESRCH

   https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html

   [EINVAL]
      The value specified by thread does not refer to a joinable thread.

NOTE:

This PR will not increase stack usage, but struct tcb_s will increase 32 bytes.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-13 18:06:56 +09:00
..
CMakeLists.txt sched/group: replace group_findbypid to task_getgroup 2024-03-05 22:24:52 +08:00
group.h sched/group: move task group into task_tcb_s to improve performance 2024-03-10 11:45:46 -03:00
group_argvstr.c sched/task: save argument counter to avoid limit check 2024-03-05 22:25:28 +08:00
group_childstatus.c group/child_status: Dynamically expand group child_status 2021-07-15 20:14:57 -07:00
group_continue.c nuttx/sched: merge up_block_task and up_unblock_task 2022-11-22 22:59:08 +08:00
group_create.c sched/pthread/join: refactor pthread join to support join task 2024-03-13 18:06:56 +09:00
group_exitinfo.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
group_foreachchild.c sched/group: move task group into task_tcb_s to improve performance 2024-03-10 11:45:46 -03:00
group_free.c sched: Author Gregory Nutt: update licenses to Apache 2021-02-09 01:21:53 -08:00
group_getegid.c sched: implement effective uid and gid interfaces 2023-08-09 17:07:58 +08:00
group_geteuid.c sched: implement effective uid and gid interfaces 2023-08-09 17:07:58 +08:00
group_getgid.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
group_getuid.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
group_join.c sched/group: change type of task group member to single queue 2024-03-07 12:39:29 +08:00
group_killchildren.c sched/group: skip child wait if here is only self in member list 2024-03-07 22:53:19 +08:00
group_leave.c sched/group: set clear flag if the group is not really needed 2024-03-11 13:58:25 +09:00
group_malloc.c sched: Author Gregory Nutt: update licenses to Apache 2021-02-09 01:21:53 -08:00
group_realloc.c Fix the initial idle tasks environment 2022-03-16 20:21:19 +08:00
group_setegid.c sched: implement effective uid and gid interfaces 2023-08-09 17:07:58 +08:00
group_seteuid.c sched: implement effective uid and gid interfaces 2023-08-09 17:07:58 +08:00
group_setgid.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
group_setuid.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
group_setupidlefiles.c sched: fix the minor style issue 2023-10-25 15:46:45 +08:00
group_setuptaskfiles.c sched/taskfiles: skip unnecessary file open/close operations to improve performance 2023-11-16 07:30:36 -08:00
group_signal.c signal: fix group signal can't dispatch some parent group twice 2023-08-03 03:35:59 -07:00
group_suspendchildren.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
group_waiter.c sched/group: Implement group_drop() 2023-02-01 09:49:09 -03:00
group_zalloc.c sched: Author Gregory Nutt: update licenses to Apache 2021-02-09 01:21:53 -08:00
Make.defs sched/group: replace group_findbypid to task_getgroup 2024-03-05 22:24:52 +08:00