diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-18 19:06:00 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-18 19:06:00 -0500 |
| commit | 6a450e411a2e03a57aa6f7ae95e62252d847ec71 (patch) | |
| tree | 135fccbedf2bab93d2695a3ebb2b01ca5cf7bdd1 /src | |
| parent | 90a0d24a84a132a998b937b6a60de945caa267cc (diff) | |
| parent | c4a7d11ea63a8dbb1faa0e27a65a244f2420d72b (diff) | |
| download | slskd-6a450e411a2e03a57aa6f7ae95e62252d847ec71.tar.gz | |
Merge pull request #1893 from slskd/mutex
Create app Mutex as explicitly session-only
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Program.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 5d7c2b13..e236886b 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -382,7 +382,11 @@ namespace slskd // only one long-running instance. try { - Mutex = new Mutex(initiallyOwned: true, Compute.Sha256Hash(AppName), out bool created); + Mutex = new Mutex( + initiallyOwned: true, + name: Compute.Sha256Hash(AppName), + options: new NamedWaitHandleOptions { CurrentUserOnly = false, CurrentSessionOnly = true }, + out bool created); if (!created) { @@ -1259,8 +1263,7 @@ namespace slskd Path.Combine(LogDirectory, $"{AppName}-.log"), outputTemplate: (OptionsAtStartup.Debug ? "[{SourceContext}] " : string.Empty) + "[{Timestamp:yyyy-MM-ddTHH:mm:ss.fff} {Level:u3}] {Message:lj}{NewLine}{Exception}", rollingInterval: RollingInterval.Day, - retainedFileTimeLimit: TimeSpan.FromDays(OptionsAtStartup.Retention.Logs), - shared: true))) // allow log file to be read concurrently + retainedFileTimeLimit: TimeSpan.FromDays(OptionsAtStartup.Retention.Logs)))) .WriteTo.Conditional( e => !string.IsNullOrEmpty(OptionsAtStartup.Logger.Loki), config => |
