void QAlertDispatcher::dispatch(QSharedPointer<QAtomicPointer<QAlertDispatcher> > tag, std::auto_ptr<libtorrent::alert> alert_ptr) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QAlertDispatcher* that = tag->loadAcquire(); #else QAlertDispatcher* that = *tag; #endif if (!that) return; QMutexLocker lock(&(that->alerts_mutex)); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) if (!tag->load()) #else if (!*tag) #endif return; bool was_empty = that->alerts.empty(); that->alerts.push_back(alert_ptr.get()); alert_ptr.release(); if (was_empty) that->alerts_condvar.wakeAll(); that->enqueueToMainThread(); Q_ASSERT(that->current_tag == tag); }
void QAlertDispatcher::dispatch(QSharedPointer<Tag> tag, std::auto_ptr<libtorrent::alert> alert_ptr) { QMutexLocker lock(&(tag->alerts_mutex)); QAlertDispatcher* that = tag->dispatcher; if (!that) return; bool was_empty = that->alerts.empty(); that->alerts.push_back(alert_ptr.get()); alert_ptr.release(); if (was_empty) that->alerts_condvar.wakeAll(); that->enqueueToMainThread(); Q_ASSERT(that->current_tag == tag); }