Exemple #1
0
// public
// runs in main thread
void
MovieLoader::clear()
{
    if (_thread.get()) {

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on requests: trying");
#endif

        boost::mutex::scoped_lock requestsLock(_requestsMutex);

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on requests: obtained");
#endif

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on kill: trying");
#endif

        boost::mutex::scoped_lock lock(_killMutex);

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on kill: obtained");
#endif

        _killed = true;

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on kill: release for kill");
#endif

        lock.unlock();

        log_debug("waking up loader thread");

        _wakeup.notify_all(); // in case it was sleeping

#ifdef GNASH_DEBUG_LOCKING
        log_debug("clear: lock on requests: release ater notify_all");
#endif
        requestsLock.unlock(); // allow the thread to die

        log_debug("MovieLoader notified, joining");
        _thread->join();
        log_debug("MovieLoader joined");
        _thread.reset();
    }

    // no thread now, can clean w/out locking
    clearRequests();

#ifdef GNASH_DEBUG_LOCKING
    log_debug("clear: lock on requests: release if not after notify_all");
#endif
}
void CalDavClient::syncFinished(int minorErrorCode, const QString &errorMessage)
{
    FUNCTION_CALL_TRACE;

    clearRequests();

    if (minorErrorCode == Buteo::SyncResults::NO_ERROR) {
        mResults = Buteo::SyncResults(QDateTime::currentDateTime().toUTC(),
                                      Buteo::SyncResults::SYNC_RESULT_SUCCESS,
                                      Buteo::SyncResults::NO_ERROR);
        emit success(getProfileName(), QString());
    } else {
        mResults = Buteo::SyncResults(QDateTime::currentDateTime().toUTC(),
                                      Buteo::SyncResults::SYNC_RESULT_FAILED,
                                      minorErrorCode);
        emit error(getProfileName(), errorMessage, minorErrorCode);
    }
}
wdmSystem::~wdmSystem()
{
    m_end_flag = true;

    if(m_server) {
        m_server->stop();
        while(m_server->currentThreads()>0) {
            clearRequests();
            Poco::Thread::sleep(5);
        }
        delete m_server;
        m_server = NULL;
    }
    if (m_root) {
        m_root->release();
        m_root = NULL;
        m_nodes.clear();
    }
}
DatabaseQuery::~DatabaseQuery()
{
    clearRequests();
    clearResults();
}
void NotebookSyncAgent::abort()
{
    NOTEBOOK_FUNCTION_CALL_TRACE;

    clearRequests();
}