MFC 线程学习之事件对象
来源:互联网 发布:java多线程计算器 编辑:程序博客网 时间:2024/06/08 08:08
// EVENT.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "windows.h"int number=1;HANDLE hEvent;unsigned long _stdcall ThreadProc1(void* lpParameter){while(number<100){WaitForSingleObject(hEvent,INFINITE);printf("线程1当前计数:%d\n",number);number++;Sleep(100);SetEvent(hEvent);}return 0;}unsigned long _stdcall ThreadProc2(void* lpParameter){while(number<100){WaitForSingleObject(hEvent,INFINITE);printf("线程2当前计数:%d\n",number);number++;Sleep(100);SetEvent(hEvent);}return 0;}int _tmain(int argc, _TCHAR* argv[]){HANDLE hThread1=CreateThread(NULL,0,ThreadProc1,NULL,0,NULL);HANDLE hThread2=CreateThread(NULL,0,ThreadProc2,NULL,0,NULL);hEvent=CreateEvent(NULL,FALSE,TRUE,(LPCWSTR)"event");CloseHandle(hThread1);CloseHandle(hThread2);while(TRUE){ ;}return 0;}
0 0
- MFC 线程学习之事件对象
- 线程同步之事件对象
- 线程同步之事件对象
- 线程事件对象之CreateEvent的用法
- MFC学习笔记 线程之信号量
- MFC 线程学习笔记之临界区
- MFC 线程学习笔记之定时器
- VC之 线程同步之事件对象(Event)
- 线程同步:事件对象
- 事件对象控制线程
- JavaScript系统学习之二 <事件,对象>
- jQuery学习笔记之九------事件对象
- JavaScript学习笔记之事件对象
- 复习笔记之三--内核对象线程同步---事件
- 线程的同步互斥之事件对象(Event)
- MFC 线程学习笔记
- MFC之多线程学习
- MFC学习笔记-线程
- explicit构造函数
- 服务器架设:CentOS搭建LAMP详细教程
- matlab编程与工程应用(第二版) 第六章 自定义函数 笔记
- Attribute value "xx" is quoted with " which must be escaped when used within the
- win8下安装.NET Framework 3.5步骤
- MFC 线程学习之事件对象
- 黑马程序员----基本数据类型封装类
- HTC 手机解锁
- HDFS异构存储
- maven命令行
- 模拟网络延迟、丢包等
- HTC官方通用解锁教程(附一键解锁工具)
- 三星N7100升级官方4.3教程
- opencv svm使用时遇到的问题