mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-07 05:22:06 -07:00
update set_process_lowest_prio()
This commit is contained in:
parent
714d4f0fca
commit
69af01d871
1 changed files with 14 additions and 8 deletions
|
@ -5,13 +5,19 @@ if sys.platform[0:3] == 'win':
|
||||||
from ctypes import wintypes
|
from ctypes import wintypes
|
||||||
|
|
||||||
def set_process_lowest_prio():
|
def set_process_lowest_prio():
|
||||||
if sys.platform[0:3] == 'win':
|
try:
|
||||||
GetCurrentProcess = windll.kernel32.GetCurrentProcess
|
if sys.platform[0:3] == 'win':
|
||||||
GetCurrentProcess.restype = wintypes.HANDLE
|
GetCurrentProcess = windll.kernel32.GetCurrentProcess
|
||||||
|
GetCurrentProcess.restype = wintypes.HANDLE
|
||||||
SetPriorityClass = windll.kernel32.SetPriorityClass
|
SetPriorityClass = windll.kernel32.SetPriorityClass
|
||||||
SetPriorityClass.argtypes = (wintypes.HANDLE, wintypes.DWORD)
|
SetPriorityClass.argtypes = (wintypes.HANDLE, wintypes.DWORD)
|
||||||
SetPriorityClass ( GetCurrentProcess(), 0x00000040 )
|
SetPriorityClass ( GetCurrentProcess(), 0x00000040 )
|
||||||
|
elif 'darwin' in sys.platform:
|
||||||
|
os.nice(10)
|
||||||
|
elif 'linux' in sys.platform:
|
||||||
|
os.nice(20)
|
||||||
|
except:
|
||||||
|
print("Unable to set lowest process priority")
|
||||||
|
|
||||||
def set_process_dpi_aware():
|
def set_process_dpi_aware():
|
||||||
if sys.platform[0:3] == 'win':
|
if sys.platform[0:3] == 'win':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue