コード例 #1
0
void Handle::setError(const scy::Error& err)
{
    // if (_error == err) return;
    assertThread();
    _error = err;
    onError(err);
}
コード例 #2
0
ファイル: Thread.cpp プロジェクト: chenbk85/Reactor-5
//this function isn't thread safe
void Thread::start(void *arg)
{
    if(m_started)
    {
        LOG(Log::WARN)<<"start a thread more than one time";
        return ;
    }

    m_started = true;
    m_arg = arg;

    int ret = pthread_create(&m_thread_id, nullptr, Thread::realStartThread, this);

    assertThread("create thread", ret);
}
コード例 #3
0
void Handle::close()
{
    assertThread();
    if (!_closed) {
        if (_ptr && !uv_is_closing(_ptr)) {
            uv_close(_ptr, [](uv_handle_t* handle) { delete handle; });
        }

        // We no longer know about the handle.
        // The handle pointer will be deleted on afterClose.
        _ptr = nullptr;
        _closed = true;

        // Send the local onClose to run final callbacks.
        onClose();
    }
}
コード例 #4
0
uv_handle_t* Handle::ptr() const
{
    assertThread();
    return _ptr;
}
コード例 #5
0
uv_loop_t* Handle::loop() const
{
    assertThread();
    return _loop;
}
コード例 #6
0
void Handle::setLoop(uv_loop_t* loop)
{
    assertThread();
    assert(_ptr == nullptr && "loop must be set before handle");
    _loop = loop;
}