C++多线程:My First C++ Thread
来源:互联网 发布:淘宝违规处罚节点 编辑:程序博客网 时间:2024/05/17 03:46
// mm.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "mm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
int i = 0;
while(i < 20)
{
printf("I am from a thread,count = %d/n",i++);
}
return 0;
}
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed/n"));
nRetCode = 1;
}
else
{
HANDLE hThread;
DWORD dwThreadId;
hThread = CreateThread(
NULL,
NULL,
ThreadProc,
NULL,
0,
&dwThreadId
);
printf("Now another thread has been Created,ID:%d/n",dwThreadId);
WaitForSingleObject(hThread,INFINITE);
CloseHandle(hThread);
cin.get();
}
return nRetCode;
}
- my first C
- C++多线程:My First C++ Thread
- My first c in Ubuntu
- My First English Thread
- QuickSort(C#) -- My First C# Program
- 4.多线程实例:thread.c
- 4.多线程实例:thread.c
- C#Thread类—多线程
- first step in order to optimization of my C program
- My first makefile to compile multiple C files
- C#Thread类多线程系列(一)入门
- first.c
- Thread(C#)
- c thread
- thread.c
- My first driver hello.c(linux 第一个驱动编写)
- linux系统下的c编程——my first program
- c#.net多线程编程教学(2):Thread类
- mtd -flash函数说明
- blog
- picturebox 图片缩放
- ABAP 学习笔记一
- 关于String笔记1
- C++多线程:My First C++ Thread
- SQL Server bcp
- 人生箴言
- 关于struts2 的 There is no Action mapped for action错误
- ubuntu-virtualbox安装与使用
- 关于工程项目开发和实施的几点看法
- ABAP 学习笔记 二
- c#中的interface abstract 与 virtual 【转】
- 可空与可绑定数据源的日期编辑选择控件 TDateEditPicker