SetPriorityClass(hProcess, PROCESS_MODE_BACKGROUND_BEGIN)失败,错误信息87,参数错误

竞天问 2019-09-18 10:26:58
相同的代码,换成ABOVE_NORMAL_PRIORITY_CLASS之类的普通线程优先级参数就可以
为什么PROCESS_MODE_BACKGROUND_BEGIN不可以呢
Win7系统
...全文
262 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
竞天问 2019-09-20
  • 打赏
  • 举报
回复
引用 5 楼 schlafenhamster 的回复:
SetPriorityClass PROCESS_MODE_BACKGROUND_BEGIN PROCESS_MODE_BACKGROUND_END,
可以设置进程中的所有线程的I/O优先级
系统不允许进程改变另一个进程的线程的I/O优先级


谢谢,以仔细看了下MSDN,确实是这样。
worldy 2019-09-19
  • 打赏
  • 举报
回复
Priority Meaning
HIGH_PRIORITY_CLASS Specify this class for a process that performs time-critical tasks that must be executed immediately. The threads of the process preempt the threads of normal or idle priority class processes. An example is the Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class application can use nearly all available CPU time.
IDLE_PRIORITY_CLASS Specify this class for a process whose threads run only when the system is idle. The threads of the process are preempted by the threads of any process running in a higher priority class. An example is a screen saver. The idle-priority class is inherited by child processes.
NORMAL_PRIORITY_CLASS Specify this class for a process with no special scheduling needs.
REALTIME_PRIORITY_CLASS Specify this class for a process that has the highest possible priority. The threads of the process preempt the threads of all other processes, including operating system processes performing important tasks. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or cause the mouse to be unresponsive.


应该是一些系统不支持ABOVE_NORMAL_PRIORITY_CLASS


schlafenhamster 2019-09-19
  • 打赏
  • 举报
回复
SetPriorityClass PROCESS_MODE_BACKGROUND_BEGIN PROCESS_MODE_BACKGROUND_END,
可以设置进程中的所有线程的I/O优先级
系统不允许进程改变另一个进程的线程的I/O优先级
竞天问 2019-09-19
  • 打赏
  • 举报
回复
引用 2 楼 zgl7903 的回复:
可能是系统不支持

那这个“可能”还可以怎么确定呢?
竞天问 2019-09-19
  • 打赏
  • 举报
回复
我的系统是Windows 7 旗舰版
MSDN上说
引用
Windows Server 2003 and Windows XP:This value is not supported.

也没说Win7不支持啊
竞天问 2019-09-18
  • 打赏
  • 举报
回复
zgl7903 2019-09-18
  • 打赏
  • 举报
回复
可能是系统不支持

2,640

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧