MCPcopy Create free account
hub / github.com/alibaba/MNN / acquireWorkIndex

Method acquireWorkIndex

source/backend/cpu/ThreadPool.cpp:92–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92int ThreadPool::acquireWorkIndex() {
93 std::lock_guard<std::mutex> _l(mQueueMutex);
94 for (int i = 0; i < MNN_THREAD_POOL_MAX_TASKS; ++i) {
95 if (mTaskAvailable[i]) {
96 mTaskAvailable[i] = false;
97 return i;
98 }
99 }
100 return -1;
101}
102void ThreadPool::releaseWorkIndex(int index) {
103 if (index < 0 || index >= MNN_THREAD_POOL_MAX_TASKS) {
104 return;

Callers 2

onConcurrencyBeginMethod · 0.80
runMethod · 0.80

Calls

no outgoing calls

Tested by 1

runMethod · 0.64