本文整理汇总了C++中CPalThread::AddThreadReference方法的典型用法代码示例。如果您正苦于以下问题:C++ CPalThread::AddThreadReference方法的具体用法?C++ CPalThread::AddThreadReference怎么用?C++ CPalThread::AddThreadReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPalThread
的用法示例。
在下文中一共展示了CPalThread::AddThreadReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternalGetCurrentThread
/*++
Function:
PALCommonCleanup
Utility function to free any resource used by the PAL.
Parameters :
step: selects the desired cleanup step
full_cleanup: FALSE: cleanup only what's needed and leave the rest
to the OS process cleanup
TRUE: full cleanup
--*/
void
PALCommonCleanup(PALCLEANUP_STEP step, BOOL full_cleanup)
{
CPalThread *pThread = InternalGetCurrentThread();
static int step_done[PALCLEANUP_STEP_INVALID] = { 0 };
switch (step)
{
case PALCLEANUP_ALL_STEPS:
case PALCLEANUP_STEP_ONE:
/* Note: in order to work correctly, this step should be executed with
init_count > 0
*/
if (!step_done[PALCLEANUP_STEP_ONE])
{
step_done[PALCLEANUP_STEP_ONE] = 1;
PALSetShutdownIntent();
//
// Let the synchronization manager know we're about to shutdown
//
CPalSynchMgrController::PrepareForShutdown();
#ifdef _DEBUG
PROCDumpThreadList();
#endif
TRACE("About to suspend every other thread\n");
/* prevent other threads from acquiring signaled objects */
PROCCondemnOtherThreads();
/* prevent other threads from using services we're shutting down */
PROCSuspendOtherThreads();
TRACE("Every other thread suspended until exit\n");
}
/* Fall down for PALCLEANUP_ALL_STEPS */
if (PALCLEANUP_ALL_STEPS != step)
break;
case PALCLEANUP_STEP_TWO:
if (!step_done[PALCLEANUP_STEP_TWO])
{
step_done[PALCLEANUP_STEP_TWO] = 1;
/* LOADFreeeModules needs to be called before unitializing the rest
of the PAL since it could result in calling DllMain for loaded
libraries. For the user DllMain, all PAL APIs should still be
functional. */
LOADFreeModules(FALSE);
#ifdef PAL_PERF
PERFDisableProcessProfile();
PERFDisableThreadProfile(FALSE);
PERFTerminate();
#endif
if (full_cleanup)
{
/* close primary handles of standard file objects */
FILECleanupStdHandles();
/* This unloads the palrt so, during its unloading, they
can call any number of APIs, so we have to be active for it to work. */
FMTMSG_FormatMessageCleanUp();
VIRTUALCleanup();
/* SEH requires information from the process structure to work;
LOADFreeModules requires SEH to be functional when calling DllMain.
Therefore SEHCleanup must go between LOADFreeModules and
PROCCleanupInitialProcess */
SEHCleanup();
PROCCleanupInitialProcess();
}
// Object manager shutdown may cause all CPalThread objects
// to be deleted. Since the CPalThread of the shutdown thread
// needs to be available for reference by the thread suspension unsafe
// operations, the reference of CPalThread is incremented here
// to keep it alive until PAL finishes cleanup.
pThread->AddThreadReference();
//
// Shutdown object manager -- this needs to happen before the
// synch manager shutdown since it will call into the synch
// manager to free object synch data
//
//.........这里部分代码省略.........