From 6b605eb76af34278861a1810cc467dbb1726daea Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 17 Jun 2019 13:55:52 +0200 Subject: [PATCH] Do not nice nice-aware adapters It is the engine process we want to run at lower priority, not the adapter it is running through. So if we know the engine is running through an adapter, because we invoked it ourselves due to -f/sUCI, and we pass the adapter the value of the -niceEngines option (presumably for it to set the priority of the engine it forks off by itself), we refrain from nicing it. --- backend.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 47b426d..a3220c2 100644 --- a/backend.c +++ b/backend.c @@ -11176,13 +11176,15 @@ void StartChessProgram (ChessProgramState *cps) { char buf[MSG_SIZ]; - int err; + int err, priority = appData.niceEngines; if (appData.noChessProgram) return; cps->initDone = FALSE; + if(cps->isUCI && strstr(appData.adapterCommand, "%niceEngines")) priority = 0; // no nicing on nice adapters! + if (strcmp(cps->host, "localhost") == 0) { - err = StartChildProcess(cps->program, cps->dir, &cps->pr, appData.niceEngines); + err = StartChildProcess(cps->program, cps->dir, &cps->pr, priority); } else if (*appData.remoteShell == NULLCHAR) { err = OpenRcmd(cps->host, appData.remoteUser, cps->program, &cps->pr); } else { @@ -11193,7 +11195,7 @@ StartChessProgram (ChessProgramState *cps) snprintf(buf, sizeof(buf), "%s %s -l %s %s", appData.remoteShell, cps->host, appData.remoteUser, cps->program); } - err = StartChildProcess(buf, "", &cps->pr, appData.niceEngines); + err = StartChildProcess(buf, "", &cps->pr, priority); } if (err != 0) { -- 1.7.0.4