当前位置: 首页>>代码示例>>C++>>正文


C++ Thread::Destroy方法代码示例

本文整理汇总了C++中Thread::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ Thread::Destroy方法的具体用法?C++ Thread::Destroy怎么用?C++ Thread::Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Thread的用法示例。


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

示例1: DetachCurrentThread

void ThreadStore::DetachCurrentThread()
{
    // The thread may not have been initialized because it may never have run managed code before.
    Thread * pDetachingThread = RawGetCurrentThread();

    // The thread was not initialized yet, so it was not attached
    if (!pDetachingThread->IsInitialized())
    {
        return;
    }

    if (!PalDetachThread(pDetachingThread))
    {
        return;
    }
        
#ifdef STRESS_LOG
    ThreadStressLog * ptsl = reinterpret_cast<ThreadStressLog *>(
        pDetachingThread->GetThreadStressLog());
    StressLog::ThreadDetach(ptsl);
#endif // STRESS_LOG

    ThreadStore* pTS = GetThreadStore();
    ReaderWriterLock::WriteHolder write(&pTS->m_Lock);
    ASSERT(rh::std::count(pTS->m_ThreadList.Begin(), pTS->m_ThreadList.End(), pDetachingThread) == 1);
    pTS->m_ThreadList.RemoveFirst(pDetachingThread);
    pDetachingThread->Destroy();
}
开发者ID:RalfKornmannEnvision,项目名称:corert,代码行数:28,代码来源:threadstore.cpp

示例2: __seed_thread_loop_callback

static int __seed_thread_loop_callback(void *param)
{
	Thread *pt = static_cast<Thread *>(param);
	while (pt->Run());

	pt->Destroy(); // Sera q fode?
	return 0;
}
开发者ID:Patuti,项目名称:seed,代码行数:8,代码来源:SdlThread.cpp

示例3:

static void *__seed_thread_loop_callback(void *param)
{
	Thread *pt = static_cast<Thread *>(param);
	while (pt->Run());
	pt->Destroy();

	return NULL;
}
开发者ID:doorxp,项目名称:seed,代码行数:8,代码来源:IphThread.cpp

示例4: DetachCurrentThreadIfHomeFiber

void ThreadStore::DetachCurrentThreadIfHomeFiber()
{
    //
    // Note: we call this when each *fiber* is destroyed, because we receive that notification outside
    // of the Loader Lock.  This allows us to safely acquire the ThreadStore lock.  However, we have to be
    // extra careful to avoid cleaning up a thread unless the fiber being destroyed is the thread's "home"
    // fiber, as recorded in AttachCurrentThread.
    //

    // The thread may not have been initialized because it may never have run managed code before.
    Thread * pDetachingThread = RawGetCurrentThread();

    ASSERT(_fls_index != FLS_OUT_OF_INDEXES);
    Thread* pThreadFromCurrentFiber = (Thread*)PalFlsGetValue(_fls_index);

    if (!pDetachingThread->IsInitialized())
    {
        if (pThreadFromCurrentFiber != NULL)
        {
            ASSERT_UNCONDITIONALLY("Detaching a fiber from an unknown thread");
            RhFailFast();
        }
        return;
    }

    if (pThreadFromCurrentFiber == NULL)
    {
        // we've seen this thread, but not this fiber.  It must be a "foreign" fiber that was 
        // borrowing this thread.
        return;
    }

    if (pThreadFromCurrentFiber != pDetachingThread)
    {
        ASSERT_UNCONDITIONALLY("Detaching a thread from the wrong fiber");
        RhFailFast();
    }

#ifdef STRESS_LOG
    ThreadStressLog * ptsl = reinterpret_cast<ThreadStressLog *>(
        pDetachingThread->GetThreadStressLog());
    StressLog::ThreadDetach(ptsl);
#endif // STRESS_LOG

    ThreadStore* pTS = GetThreadStore();
    ReaderWriterLock::WriteHolder write(&pTS->m_Lock);
    ASSERT(rh::std::count(pTS->m_ThreadList.Begin(), pTS->m_ThreadList.End(), pDetachingThread) == 1);
    pTS->m_ThreadList.RemoveFirst(pDetachingThread);
    pDetachingThread->Destroy();
}
开发者ID:ericeil,项目名称:corert,代码行数:50,代码来源:threadstore.cpp


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