explicit type()

in include/unifex/win32/windows_thread_pool.hpp [186:211]


    explicit type(windows_thread_pool& pool, bool isStopPossible) {
        ::InitializeThreadpoolEnvironment(&environ_);
        ::SetThreadpoolCallbackPool(&environ_, pool.threadPool_);

        work_ = ::CreateThreadpoolWork(
            isStopPossible ? &stoppable_work_callback : &unstoppable_work_callback,
            static_cast<void*>(this),
            &environ_);
        if (work_ == nullptr) {
            DWORD errorCode = ::GetLastError();
            ::DestroyThreadpoolEnvironment(&environ_);
            throw_(
                std::system_error{static_cast<int>(errorCode), std::system_category(), "CreateThreadpoolWork()"});
        }

        if (isStopPossible) {
            state_ = new (std::nothrow) std::atomic<std::uint32_t>(not_started);
            if (state_ == nullptr) {
                ::CloseThreadpoolWork(work_);
                ::DestroyThreadpoolEnvironment(&environ_);
                throw_(std::bad_alloc{});
            }
        } else {
            state_ = nullptr;
        }
    }