| 226 | ****************************************************************************/ |
| 227 | |
| 228 | void group_initialize(FAR struct tcb_s *tcb) |
| 229 | { |
| 230 | FAR struct task_group_s *group; |
| 231 | |
| 232 | DEBUGASSERT(tcb && tcb->group); |
| 233 | group = tcb->group; |
| 234 | spin_lock_init(&group->tg_lock); |
| 235 | |
| 236 | /* Allocate mm_map list if required */ |
| 237 | |
| 238 | mm_map_initialize(&group->tg_mm_map, |
| 239 | (tcb->flags & TCB_FLAG_TTYPE_KERNEL) != 0); |
| 240 | |
| 241 | #ifdef HAVE_GROUP_MEMBERS |
| 242 | /* Assign the PID of this new task as a member of the group. */ |
| 243 | |
| 244 | sq_addlast(&tcb->member, &group->tg_members); |
| 245 | #endif |
| 246 | |
| 247 | /* Save the ID of the main task within the group of threads. This needed |
| 248 | * for things like SIGCHLD. It ID is also saved in the TCB of the main |
| 249 | * task but is also retained in the group which may persist after the main |
| 250 | * task has exited. |
| 251 | */ |
| 252 | |
| 253 | if (group != &g_kthread_group) |
| 254 | { |
| 255 | group->tg_pid = tcb->pid; |
| 256 | } |
| 257 | |
| 258 | group->tg_info->ta_pid = group->tg_pid; |
| 259 | } |
no test coverage detected