MCPcopy Create free account
hub / github.com/Atmosphere-NX/Atmosphere / GetThreadList

Method GetThreadList

libraries/libmesosphere/source/kern_k_process.cpp:1111–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109 }
1110
1111 Result KProcess::GetThreadList(s32 *out_num_threads, ams::kern::svc::KUserPointer<u64 *> out_thread_ids, s32 max_out_count) {
1112 /* Lock the list. */
1113 KScopedLightLock lk(m_list_lock);
1114
1115 /* Iterate over the list. */
1116 s32 count = 0;
1117 auto end = this->GetThreadList().end();
1118 for (auto it = this->GetThreadList().begin(); it != end; ++it) {
1119 /* If we're within array bounds, write the id. */
1120 if (count < max_out_count) {
1121 /* Get the thread id. */
1122 KThread *thread = std::addressof(*it);
1123 const u64 id = thread->GetId();
1124
1125 /* Copy the id to userland. */
1126 R_TRY(out_thread_ids.CopyArrayElementFrom(std::addressof(id), count));
1127 }
1128
1129 /* Increment the count. */
1130 ++count;
1131 }
1132
1133 /* We successfully iterated the list. */
1134 *out_num_threads = count;
1135 R_SUCCEED();
1136 }
1137
1138 KProcess::State KProcess::SetDebugObject(void *debug_object) {
1139 /* Attaching should only happen to non-null objects while the scheduler is locked. */

Callers 3

SetActivityMethod · 0.95
EnterJitDebugMethod · 0.95
TerminateChildrenFunction · 0.45

Calls 4

CopyArrayElementFromMethod · 0.80
endMethod · 0.45
beginMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected