• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ currentThread函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中currentThread函数的典型用法代码示例。如果您正苦于以下问题:C++ currentThread函数的具体用法?C++ currentThread怎么用?C++ currentThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了currentThread函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: currentThread

bool 
Thread::interrupted()
{
    ThreadHandle handle = currentThread();
  
    if(!handle.is_null()) {
        return handle->consumeInterruptionSync();
    } else {
        return false;
    }
};
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:11,代码来源:Thread.C


示例2: add

void AddThr::run()
{
	Functions::DemuxersInfo demuxersInfo;
	for (Module *module : QMPlay2Core.getPluginsInstance())
		for (const Module::Info &mod : module->getModulesInfo())
			if (mod.type == Module::DEMUXER)
				demuxersInfo += {mod.name, mod.icon.isNull() ? module->icon() : mod.icon, mod.extensions};
	add(urls, par, demuxersInfo, existingEntries.isEmpty() ? nullptr : &existingEntries, loadList);
	if (currentThread() == pLW.thread()) //jeżeli funkcja działa w głównym wątku
		finished();
}
开发者ID:arthurzam,项目名称:QMPlay2,代码行数:11,代码来源:PlaylistWidget.cpp


示例3: ASSERT

void SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown()
{
    ASSERT(currentThread() == database()->databaseContext()->databaseThread()->getThreadID());

    // If the transaction is in progress, we should roll it back here, since this
    // is our last opportunity to do something related to this transaction on the
    // DB thread. Amongst other work, doCleanup() will clear m_sqliteTransaction
    // which invokes SQLiteTransaction's destructor, which will do the roll back
    // if necessary.
    doCleanup();
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:11,代码来源:SQLTransactionBackend.cpp


示例4: ASSERT

RefPtr<DOMStringList> IDBObjectStore::indexNames() const
{
    ASSERT(currentThread() == m_transaction->database().originThreadID());

    RefPtr<DOMStringList> indexNames = DOMStringList::create();
    for (auto& name : m_info.indexNames())
        indexNames->append(name);
    indexNames->sort();

    return indexNames;
}
开发者ID:caiolima,项目名称:webkit,代码行数:11,代码来源:IDBObjectStore.cpp


示例5: context

bool OfflineAudioDestinationHandler::renderIfNotSuspended(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFrames)
{
    // We don't want denormals slowing down any of the audio processing
    // since they can very seriously hurt performance.
    // This will take care of all AudioNodes because they all process within this scope.
    DenormalDisabler denormalDisabler;

    context()->deferredTaskHandler().setAudioThread(currentThread());

    if (!context()->isDestinationInitialized()) {
        destinationBus->zero();
        return false;
    }

    // Take care pre-render tasks at the beginning of each render quantum. Then
    // it will stop the rendering loop if the context needs to be suspended
    // at the beginning of the next render quantum.
    if (context()->handlePreOfflineRenderTasks()) {
        suspendOfflineRendering();
        return true;
    }

    // Prepare the local audio input provider for this render quantum.
    if (sourceBus)
        m_localAudioInputProvider.set(sourceBus);

    ASSERT(numberOfInputs() >= 1);
    if (numberOfInputs() < 1) {
        destinationBus->zero();
        return false;
    }
    // This will cause the node(s) connected to us to process, which in turn will pull on their input(s),
    // all the way backwards through the rendering graph.
    AudioBus* renderedBus = input(0).pull(destinationBus, numberOfFrames);

    if (!renderedBus) {
        destinationBus->zero();
    } else if (renderedBus != destinationBus) {
        // in-place processing was not possible - so copy
        destinationBus->copyFrom(*renderedBus);
    }

    // Process nodes which need a little extra help because they are not connected to anything, but still need to process.
    context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames);

    // Let the context take care of any business at the end of each render quantum.
    context()->handlePostOfflineRenderTasks();

    // Advance current sample-frame.
    size_t newSampleFrame = m_currentSampleFrame + numberOfFrames;
    releaseStore(&m_currentSampleFrame, newSampleFrame);

    return false;
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:54,代码来源:OfflineAudioDestinationNode.cpp


示例6: m_nextFireTime

TimerBase::TimerBase()
    : m_nextFireTime(0)
    , m_unalignedNextFireTime(0)
    , m_repeatInterval(0)
    , m_heapIndex(-1)
    , m_cachedThreadGlobalTimerHeap(0)
#if ENABLE(ASSERT)
    , m_thread(currentThread())
#endif
{
}
开发者ID:Rajesh-Veeranki,项目名称:engine,代码行数:11,代码来源:Timer.cpp


示例7: LOG

void IDBOpenDBRequest::onSuccess(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBOpenDBRequest::onSuccess()");

    ASSERT(currentThread() == originThreadID());

    setResult(IDBDatabase::create(*scriptExecutionContext(), connectionProxy(), resultData));
    m_isDone = true;

    enqueueEvent(IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this));
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:11,代码来源:IDBOpenDBRequest.cpp


示例8: ASSERT

bool IDBOpenDBRequest::dispatchEvent(Event& event)
{
    ASSERT(currentThread() == originThreadID());

    bool result = IDBRequest::dispatchEvent(event);

    if (m_transaction && m_transaction->isVersionChange() && (event.type() == eventNames().errorEvent || event.type() == eventNames().successEvent))
        m_transaction->database().connectionProxy().didFinishHandlingVersionChangeTransaction(m_transaction->database().databaseConnectionIdentifier(), *m_transaction);

    return result;
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:11,代码来源:IDBOpenDBRequest.cpp


示例9: ASSERT

void TimerBase::stop()
{
    ASSERT(m_thread == currentThread());

    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:11,代码来源:Timer.cpp


示例10: m_thread

ThreadState::ThreadState(intptr_t* startOfStack)
    : m_thread(currentThread())
    , m_startOfStack(startOfStack)
{
    ASSERT(!**s_threadSpecific);
    **s_threadSpecific = this;

    // FIXME: This is to silence clang that complains about unused private
    // member. Remove once we implement stack scanning that uses it.
    (void) m_startOfStack;
}
开发者ID:Metrological,项目名称:chromium,代码行数:11,代码来源:ThreadState.cpp


示例11: LOG

void IDBDatabase::didCommitTransaction(IDBTransaction& transaction)
{
    LOG(IndexedDB, "IDBDatabase::didCommitTransaction %s", transaction.info().identifier().loggingString().utf8().data());

    ASSERT(currentThread() == originThreadID());

    if (m_versionChangeTransaction == &transaction)
        m_info.setVersion(transaction.info().newVersion());

    didCommitOrAbortTransaction(transaction);
}
开发者ID:eocanha,项目名称:webkit,代码行数:11,代码来源:IDBDatabase.cpp


示例12: m_scriptExecutionContext

WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject)
    : m_scriptExecutionContext(workerObject->scriptExecutionContext())
    , m_workerObject(workerObject)
    , m_unconfirmedMessageCount(0)
    , m_workerThreadHadPendingActivity(false)
    , m_askedToTerminate(false)
{
    ASSERT(m_workerObject);
    ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
           || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->threadID()));
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:11,代码来源:WorkerMessagingProxy.cpp


示例13: ASSERT

void IDBDatabase::renameIndex(IDBIndex& index, const String& newName)
{
    ASSERT(currentThread() == originThreadID());
    ASSERT(m_versionChangeTransaction);
    ASSERT(m_info.hasObjectStore(index.objectStore().info().name()));
    ASSERT(m_info.infoForExistingObjectStore(index.objectStore().info().name())->hasIndex(index.info().name()));

    m_info.infoForExistingObjectStore(index.objectStore().info().name())->infoForExistingIndex(index.info().identifier())->rename(newName);

    m_versionChangeTransaction->renameIndex(index, newName);
}
开发者ID:eocanha,项目名称:webkit,代码行数:11,代码来源:IDBDatabase.cpp


示例14: ASSERT

void TimerBase::stop()
{
    ASSERT(m_thread == currentThread() || (isMainThread() || pthread_main_np()) && WebCoreWebThreadIsLockedOrDisabled());

    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
开发者ID:sanyaade-mobiledev,项目名称:Webkit-Projects,代码行数:11,代码来源:Timer.cpp


示例15: m_nextFireTime

TimerBase::TimerBase()
    : m_nextFireTime(0)
    , m_unalignedNextFireTime(0)
    , m_repeatInterval(0)
    , m_heapIndex(-1)
    , m_cachedThreadGlobalTimerHeap(0)
#ifndef NDEBUG
    , m_thread(currentThread())
    , m_wasDeleted(false)
#endif
{
}
开发者ID:caiolima,项目名称:webkit,代码行数:12,代码来源:Timer.cpp


示例16: endParallel

void endParallel()
{
	__sync_fetch_and_add(&gActiveThreadCount, -1);
	while (gActiveThreadCount > 0)
		;

	if (currentThread() == 0)
	{
		// Stop all but me
		*((unsigned int*) 0xffff0064) = ~1;	
	}
}
开发者ID:ForrestBlue,项目名称:NyuziProcessor,代码行数:12,代码来源:membench.c


示例17: initializeMainThread

void initializeMainThread(void (*function)(MainThreadFunction, void*))
{
    static bool initializedMainThread;
    if (initializedMainThread)
        return;
    initializedMainThread = true;
    callOnMainThreadFunction = function;

    mainThreadIdentifier = currentThread();

    AtomicString::init();
}
开发者ID:dstockwell,项目名称:blink,代码行数:12,代码来源:MainThread.cpp


示例18: initializeThreading

void initializeThreading()
{
    if (!atomicallyInitializedStaticMutex) {
        atomicallyInitializedStaticMutex = new Mutex;
        threadMapMutex();
        initializeRandomNumberGenerator();
#if !PLATFORM(DARWIN) || PLATFORM(CHROMIUM)
        mainThreadIdentifier = currentThread();
#endif
        initializeMainThread();
    }
}
开发者ID:freeworkzz,项目名称:nook-st-oss,代码行数:12,代码来源:ThreadingPthreads.cpp


示例19: initializeMainThread

void initializeMainThread()
{
    static bool initializedMainThread;
    if (initializedMainThread)
        return;
    initializedMainThread = true;

    mainThreadIdentifier = currentThread();

    initializeMainThreadPlatform();
    initializeGCThreads();
}
开发者ID:llelectronics,项目名称:lls-qtwebkit,代码行数:12,代码来源:MainThread.cpp


示例20: dataLog

NEVER_INLINE void LockBase::lockSlow()
{
    unsigned spinCount = 0;

    // This magic number turns out to be optimal based on past JikesRVM experiments.
    const unsigned spinLimit = 40;
    
    for (;;) {
        uint8_t currentByteValue = m_byte.load();
        if (verbose)
            dataLog(toString(currentThread(), ": locking with ", currentByteValue, "\n"));

        // We allow ourselves to barge in.
        if (!(currentByteValue & isHeldBit)
            && m_byte.compareExchangeWeak(currentByteValue, currentByteValue | isHeldBit))
            return;

        // If there is nobody parked and we haven't spun too much, we can just try to spin around.
        if (!(currentByteValue & hasParkedBit) && spinCount < spinLimit) {
            spinCount++;
            std::this_thread::yield();
            continue;
        }

        // Need to park. We do this by setting the parked bit first, and then parking. We spin around
        // if the parked bit wasn't set and we failed at setting it.
        if (!(currentByteValue & hasParkedBit)
            && !m_byte.compareExchangeWeak(currentByteValue, currentByteValue | hasParkedBit))
            continue;

        // We now expect the value to be isHeld|hasParked. So long as that's the case, we can park.
        ParkingLot::ParkResult parkResult =
            ParkingLot::compareAndPark(&m_byte, isHeldBit | hasParkedBit);
        if (parkResult.wasUnparked) {
            switch (static_cast<Token>(parkResult.token)) {
            case DirectHandoff:
                // The lock was never released. It was handed to us directly by the thread that did
                // unlock(). This means we're done!
                RELEASE_ASSERT(isHeld());
                return;
            case BargingOpportunity:
                // This is the common case. The thread that called unlock() has released the lock,
                // and we have been woken up so that we may get an opportunity to grab the lock. But
                // other threads may barge, so the best that we can do is loop around and try again.
                break;
            }
        }

        // We have awoken, or we never parked because the byte value changed. Either way, we loop
        // around and try again.
    }
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:52,代码来源:Lock.cpp



注:本文中的currentThread函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ currentTimeMS函数代码示例发布时间:2022-05-30
下一篇:
C++ currentTextChanged函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap