dynamite.cpp
来自「window下的多线程编程参考书。值得一读」· C++ 代码 · 共 52 行
CPP
52 行
//
// FILE: Dynamite.cpp
//
// Copyright (c) 1997 by Aaron Michael Cohen and Mike Woodring
//
/////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <stdio.h>
#include "DynamiteThread.h"
void main( void )
{
// The DynamiteThreadHandler object will be the handler for
// the new thread that will be created when the constructor
// for the DynamiteThread object is executed.
//
CDynamiteThread DynamiteThreadHandler;
CMclThread DynamiteThread(&DynamiteThreadHandler);
// Our new dynamite thread was started when the constructor
// for DynamiteThread ran. We'll wait for the thread to
// become signaled, indicating that the thread has exited.
//
printf(
"[tid 0x%08lx] Waiting for dynamite thread to exit...\n",
GetCurrentThreadId()
);
DynamiteThread.Wait(INFINITE);
// Determine why the thread exited.
//
DWORD dwExitCode;
if( DynamiteThread.GetExitCode(&dwExitCode) )
{
printf(
"[tid 0x%08lx] Dynamite thread has exited with exit code 0x%x\n",
GetCurrentThreadId(),
dwExitCode
);
}
else
{
printf(
"[tid 0x%08lx] Dynamite thread has exited - code not available.\n",
GetCurrentThreadId()
);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?