| 35 | } |
| 36 | |
| 37 | AsyncResult 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 | |
| 59 | AsyncResult NamedThread::join() SKR_NOEXCEPT |
| 60 | { |
no test coverage detected