f8d6f19dba
While a detected game runs, Game Boost sets process default CPU Sets from the CPU topology: on AMD X3D with one larger L3 the game goes to the V-Cache CCD, on Intel hybrid CPUs to the P-cores, and selected background apps (browsers, sync clients, updaters, launchers) to the other cores. On dual-CCD parts with equal L3 only the background moves, unless Isolation mode also keeps the game on CCD0. Single-L3 and unreadable topologies are left to Windows. Above Normal priority for the game is optional; never High. Each change is written to a journal before it is made and undone when the game exits, Game Boost is turned off or ThreadPilot closes, and on the next start after a crash. Only values still exactly as Game Boost set them are restored, never one a user rule or a manual change has taken over since. Persistent rules and Game Boost share one apply gate, and a rule always wins over Game Boost for the setting it covers. The switch, mode and lists are on the Tweaks page, off by default, and take effect without a restart.
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
namespace ThreadPilot.Services
|
|
{
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
/// <summary>
|
|
/// One gate for everything that applies policies to running processes on its own (persistent rules,
|
|
/// Game Boost), so the two never write CPU Sets or priorities to the same process at the same time.
|
|
/// </summary>
|
|
public sealed class ProcessPolicyApplyGate
|
|
{
|
|
private readonly SemaphoreSlim semaphore = new(1, 1);
|
|
|
|
public async Task<IDisposable> EnterAsync(CancellationToken cancellationToken = default)
|
|
{
|
|
await this.semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
|
return new Releaser(this.semaphore);
|
|
}
|
|
|
|
private sealed class Releaser(SemaphoreSlim semaphore) : IDisposable
|
|
{
|
|
private int released;
|
|
|
|
public void Dispose()
|
|
{
|
|
if (Interlocked.Exchange(ref this.released, 1) == 0)
|
|
{
|
|
semaphore.Release();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|