MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / GetThreadGroupSize

Method GetThreadGroupSize

src/task/task_control_block.cpp:106–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104auto TaskControlBlock::LeaveThreadGroup() -> void { ThreadGroupLink::unlink(); }
105
106auto TaskControlBlock::GetThreadGroupSize() const -> size_t {
107 if (aux->tgid == 0) {
108 // 未加入任何线程组
109 return 1;
110 }
111
112 size_t count = 1;
113
114 // 向前遍历至链表头
115 const ThreadGroupLink* curr = etl_previous;
116 while (curr) {
117 ++count;
118 curr = curr->etl_previous;
119 }
120
121 // 向后遍历至链表尾
122 curr = etl_next;
123 while (curr) {
124 ++count;
125 curr = curr->etl_next;
126 }
127
128 return count;
129}
130
131TaskControlBlock::TaskControlBlock(const char* _name, int priority,
132 ThreadEntry entry, void* arg)

Callers 4

ExitMethod · 0.80
test_thread_group_basicFunction · 0.80
test_clone_threadFunction · 0.80

Calls

no outgoing calls

Tested by 3

test_thread_group_basicFunction · 0.64
test_clone_threadFunction · 0.64