mirror of
https://github.com/apache/nuttx.git
synced 2026-10-19 20:58:54 +00:00
Revert "sched/group: move task group into task_tcb_s to improve performance"
This reverts commit 29e50ffa73.
reason:
Placing the main thread and the gourd in the same memory block, and allocating and freeing memory simultaneously, presents the following two problems:
When the main thread creates a child thread and performs a detach operation, there is a possibility that the main thread may have exited, but the main thread's TCB (Transaction Control Block) may not have been released.
This could potentially cause the main thread's TCB to be double-freed. The core contradiction in this problem lies in binding the main thread's TCB (Trust Container Registry) and the group together. When releasing the main thread's TCB, an additional check is needed to ensure the main thread was the last to leave the group. If this check and the free operation are atomically guaranteed, the logic is sound, and double freeing won't occur. However, this atomicity cannot be completely guaranteed. If other free operations cause a block, problems still arise.
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
This commit is contained in:
parent
1fe3de379a
commit
31e562b10f
11 changed files with 46 additions and 76 deletions
|
|
@ -129,7 +129,7 @@ void mm_map_unlock(void);
|
|||
* Name: mm_map_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialization function, called only by group_postinitialize
|
||||
* Initialization function, called only by group_initialize
|
||||
*
|
||||
* Input Parameters:
|
||||
* mm - Pointer to the mm_map structure to be initialized
|
||||
|
|
|
|||
|
|
@ -746,10 +746,6 @@ struct task_tcb_s
|
|||
/* Common TCB fields ******************************************************/
|
||||
|
||||
struct tcb_s cmn; /* Common TCB fields */
|
||||
|
||||
/* Task Group *************************************************************/
|
||||
|
||||
struct task_group_s group; /* Shared task group data */
|
||||
};
|
||||
|
||||
/* struct pthread_tcb_s *****************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue