int CThreadTask::Stop(bool blocking /* = true */) { bool auto_destroy = m_AutoDestroy; m_Abort.SetValue(1); DoAbort(); if (!blocking || !m_Thread) return ZHD_SUCCESS; return auto_destroy ? ZHD_FAILURE : m_Thread->Wait(); }
/*---------------------------------------------------------------------- | PLT_ThreadTask::Stop +---------------------------------------------------------------------*/ NPT_Result PLT_ThreadTask::Stop(bool blocking /* = true */) { m_Abort.SetValue(1); // tell thread we want to die DoAbort(); // wait for thread to be dead return (blocking && m_Thread)?m_Thread->Wait():NPT_SUCCESS; }
/*---------------------------------------------------------------------- | PLT_ThreadTask::Stop +---------------------------------------------------------------------*/ NPT_Result PLT_ThreadTask::Stop(bool blocking /* = true */) { // keep variable around in case // we get destroyed bool auto_destroy = m_AutoDestroy; // tell thread we want to die m_Abort.SetValue(1); DoAbort(); // return without waiting if non blocking or not started if (!blocking || !m_Thread) return NPT_SUCCESS; // if auto-destroy, the thread may be already dead by now // so we can't wait on m_Thread. // only Task Manager will know when task is finished return auto_destroy?NPT_FAILURE:m_Thread->Wait(); }
void FileIOObject::Abort(ErrorResult& aRv) { if (mReadyState != 1) { // XXX The spec doesn't say this aRv.Throw(NS_ERROR_DOM_FILE_ABORT_ERR); return; } ClearProgressEventTimer(); mReadyState = 2; // There are DONE constants on multiple interfaces, // but they all have value 2. // XXX The spec doesn't say this mError = new DOMError(GetOwner(), NS_LITERAL_STRING("AbortError")); nsString finalEvent; DoAbort(finalEvent); // Dispatch the events DispatchProgressEvent(NS_LITERAL_STRING(ABORT_STR)); DispatchProgressEvent(finalEvent); }
NS_IMETHODIMP FileIOObject::Abort() { if (mReadyState != 1) { // XXX The spec doesn't say this return NS_ERROR_DOM_FILE_ABORT_ERR; } ClearProgressEventTimer(); mReadyState = 2; // There are DONE constants on multiple interfaces, // but they all have value 2. // XXX The spec doesn't say this mError = DOMError::CreateWithName(NS_LITERAL_STRING("AbortError")); nsString finalEvent; nsresult rv = DoAbort(finalEvent); // Dispatch the events DispatchProgressEvent(NS_LITERAL_STRING(ABORT_STR)); DispatchProgressEvent(finalEvent); return rv; }