windows系统调用 调度优先级
#include "iostream"
#include "windows.h"
using namespace std; class CWorkerThread{
public:
CWorkerThread(LPCTSTR m_szName):m_szName(m_szName),m_hThread(INVALID_HANDLE_VALUE){
m_hThread=CreateThread(
NULL,
,
ThreadProc,
reinterpret_cast<LPVOID>(this),
,
NULL
);
} virtual ~CWorkerThread(){CloseHandle(m_hThread);} virtual void WaitForCompletion(){
WaitForSingleObject(m_hThread,INFINITE);
} virtual void SetPriority(int nPriority){
SetThreadPriority(m_hThread,nPriority);
} virtual void Suspend(){
SuspendThread(m_hThread);
} virtual void Resume(){
ResumeThread(m_hThread);
} protected:
static DWORD WINAPI ThreadProc(LPVOID lpParam){
CWorkerThread *pThis=
reinterpret_cast<CWorkerThread*>(lpParam); pThis->DoStuff();
return ();
} virtual void DoStuff(){
for(int n=;n<;n++){
printf("Thread %s ID:%d,count %d\n",m_szName,GetCurrentThreadId(),n);
}
} protected:
HANDLE m_hThread;
LPCTSTR m_szName;
}; void main(){ CWorkerThread wtB("B");
CWorkerThread wtA("A");
wtA.SetPriority(THREAD_PRIORITY_LOWEST); wtA.WaitForCompletion();
wtB.WaitForCompletion(); cout<<"Both threads complete."<<endl; getchar();
}
windows系统调用 调度优先级的更多相关文章
- Windows系统调用架构分析—也谈KiFastCallEntry函数地址的获取
为什么要写这篇文章 1. 因为最近在学习<软件调试>这本书,看到书中的某个调试历程中讲了Windows的系统调用的实现机制,其中讲到了从Ring3跳转到Ring0之后直接进入了K ...
- Windows系统调用中的现场保存
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中的现场保存 我们之前介绍过三环进零环的步骤 ...
- Windows系统调用中的系统服务表描述符
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中的系统服务表描述符 在前面,我们将解过 ...
- Windows系统调用中API的3环部分(依据分析重写ReadProcessMemory函数)
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中API的3环部分 一.R3环API分析的重 ...
- Windows系统调用中API从3环到0环(下)
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中API从3环到0环(下) 如果对API在 ...
- Windows系统调用中API从3环到0环(上)
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中API从3环到0环(上) 如果对API在三 ...
- Windows系统调用中的系统服务表
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html Windows系统调用中的系统服务表 如果这部分不理解,可以查看 ...
- windows系统调用 遍历进程的虚拟地址
#include "iostream" #include "windows.h" #include "shlwapi.h" #include ...
- windows系统调用 获取当前内存信息
#include "iostream" #include "windows.h" #include "shlwapi.h" #include ...
随机推荐
- DOM的概念及子节点类型【转】
前言 DOM的作用是将网页转为一个javascript对象,从而可以使用javascript对网页进行各种操作(比如增删内容).浏览器会根据DOM模型,将HTML文档解析成一系列的节点,再由这些节点组 ...
- javascrit2.0完全参考手册(第二版) 第2章第2节 语言特性
脚本执行顺序 js代码是按照它们在html中出现的顺序一行一行被解释的.这表明把函数定义和变量声明放到<head>中会很好.这保证了函数的代码和事件相关的处理程序不会立即执行. 大 ...
- 解决redhat linux下IP地址可以ping通,域名无法ping通问题
解决redhat linux下IP地址可以ping通,域名无法ping通 在/etc/resolv.conf中添点东西 格式如下: nameserver xxx.xxx.xxx.xxx nameser ...
- java script小结
javascript是一种嵌入在网页里的程序段,是一种解释性语言,只能被浏览器解释执行.出于安全性的考虑,增加了javascript的限制,增强了客户端交互功能. JavaScript的作用: 1.增 ...
- js事件冒泡和事件捕获的区别
- Hadoop.2.x_MR-Shuffle过程
1.map到reduce中间的一个过程 洗牌,打乱(打乱我们传递的所有元素)(流程:input->map->reduce->output) 2.map()->shuffle-& ...
- POJ 2838 单调队列
Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 55309 Accepted: 15911 ...
- HDU 2546
饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...
- Struts 2.x No result defined for action 异常
这是我跑struts2的第一个例子,跑的也够郁闷的,这个问题烦了我几个钟... 2011-5-10 10:10:17 com.opensymphony.xwork2.util.logging.co ...
- BizTalk开发系列(二十) 类型作用域
Orchestration中的Type概念跟.NET 里的Class一样,可以在Orchestration开过过程中将多个实例绑定到一种类型.Orchestration 视图里包括的类型有Port T ...