MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / start

Method start

modules/core/core/src/async/named_thread.cpp:37–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37AsyncResult NamedThread::start(NamedThreadFunction* pFunc) SKR_NOEXCEPT
38{
39 if (skr_atomic32_load_acquire(&started))
40 {
41 SKR_LOG_ERROR(u8"thread is already started!");
42 return ASYNC_RESULT_ERROR_THREAD_ALREADY_STARTES;
43 }
44
45 this->func = pFunc;
46
47 tDesc.pFunc = &threadFunc;
48 tDesc.pData = this;
49 skr_init_thread(&tDesc, &tHandle);
50
51 const auto P = (SThreadPriority)skr_atomic32_load_acquire(&priority);
52 skr_thread_set_priority(tHandle, P);
53
54 wait_timeout([this]() { return skr_atomic32_load_acquire(&started); }, 4);
55
56 return ASYNC_RESULT_OK;
57}
58
59AsyncResult NamedThread::join() SKR_NOEXCEPT
60{

Callers 2

initializeMethod · 0.45
request_runFunction · 0.45

Calls 4

wait_timeoutClass · 0.85
skr_init_threadFunction · 0.50
skr_thread_set_priorityFunction · 0.50

Tested by

no test coverage detected