yf13 commented on code in PR #12320:
URL: https://github.com/apache/nuttx/pull/12320#discussion_r1596784821
##########
sched/group/group_create.c:
##########
@@ -119,20 +121,42 @@ int group_initialize(FAR struct task_tcb_s *tcb, uint8_t
ttype)
DEBUGASSERT(tcb && !tcb->cmn.group);
+ ttype &= TCB_FLAG_TTYPE_MASK;
+
+ /* Late coming kthread reuses the shared group */
+
+ if (ttype == TCB_FLAG_TTYPE_KERNEL && g_kthread_group.tg_info)
+ {
+ tcb->cmn.group = &g_kthread_group;
+ return OK;
+ }
+
+ if (!g_kthread_group.tg_info)
+ {
+ sinfo("sizeof(*group)=%zu\n", sizeof(*group));
+ }
+
/* Allocate the group structure and assign it to the TCB */
- group = &tcb->group;
+ group = (ttype == TCB_FLAG_TTYPE_KERNEL) ? &g_kthread_group :
+ kmm_zalloc(sizeof(*group));
Review Comment:
Maybe that is better addressed by a separate set of statical task/group
management APIs?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]