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 ...
随机推荐
- C# 非模式窗体show()和模式窗体showdialog()的区别(转)
对话框不是模式就是无模式的.模式对话框,在可以继续操作应用程序的其他部分之前,必须被关闭(隐藏或卸载).例如,如果一个对话框,在可以切换到其它窗 体或对话框之前要求先单击“确定”或“取消”,则它就是模 ...
- struts2中拦截器与过滤器的区别
1.拦截器是基于java反射机制的,而过滤器是基于函数回调的. 2.过滤器依赖与servlet容器,而拦截器不依赖与servlet容器. 3.拦截器只能对Action请求起作用,而过滤器则可以对几乎 ...
- jquery中prop()方法和attr()方法的区别浅析
官方例举的例子感觉和attr()差不多,也不知道有什么区别,既然有了prop()这个新方法,不可能没用吧,那什么时候该用attr(),什么时候该用prop()呢 jquery1.6中新加了一个方法pr ...
- Soldier and Bananas
Soldier and Bananas 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=173141 题意: 给 ...
- github的git.exe的目录所在
github的git.exe位于 C:\Users\[username]\AppData\Local\GitHub\PortableGit_25d850739bc178b2eb13c3e2a9faaf ...
- [LintCode] Remove Linked List Elements 移除链表元素
Remove all elements from a linked list of integers that have value val. Have you met this question i ...
- scp
scp -rp -P22 test.txt root@xxxx:/tmp/ scp -rp -P22 root@xxxx:/tmp/1.txt ./
- web前端开发CSS命名规范参考
做为一个web前端工程师,每天接触HTML.css就像吃饭一样,但是作为一名合作.优秀的web前端工程师,对DIV+CSS命名还是有一定的规范的,本文整理了一份web前端开发中DIV+CSS各种命名规 ...
- c语言中的文件流
一.打开和关闭文件 #include int main( void ) { FILE* pReadFile = fopen( "E:\\mytest.txt", "r&q ...
- jQuery cdn使用介绍
如果您不希望下载并存放jQuery,那么也可以通过 CDN(内容分发网络)引用它,下面是具体实现,有类似需求的各位可以参考下哈,希望对你有所帮助 如果您不希望下载并存放 jQuery,那么也可以通 ...