⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.cpp

📁 监视CPU使用率的历史情况,个位可以下载后测试测试
💻 CPP
字号:
//This piece of code has been written in University of Hull by 
//Warren Viant then Head of Department
//in  Department of Computer Science
//Some alteration have been made by me  

#include "thread.h"


HANDLE Thread::start() {
    unsigned threadId=0;
	_hThread = (HANDLE)_beginthreadex(
		NULL,		// no security attributes (child cannot inherited handle)
		1024*1024,	// 1MB stack size
		threadFunc,	// code to run on new thread
		this,		// pointer to host application class
		0,			// run immediately (could create suspended)
		&threadId	// OUT: returns thread ID
	);
	
	return _hThread;
}

void Thread::waitForTermination() {
	// wait for it to stop
	_isRunning = false ;
	WaitForSingleObject(_hThread, INFINITE);
	// close thread handle
	CloseHandle(_hThread);
	_hThread=0;
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -