def set_highest_priority():
try:
import psutil
except ImportError:
return
proc = psutil.Process()
if not hasattr(proc, 'nice'):
return
# Want to set realtime on Windows.
# Fail hard for anything else right now, so it is obvious what to fix
# when adding other OS support.
try:
proc.nice(psutil.REALTIME_PRIORITY_CLASS)
return True
except psutil.AccessDenied:
pass
评论列表
文章目录