diff options
| author | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2025-12-07 00:19:04 +0000 |
|---|---|---|
| committer | copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | 2025-12-07 00:19:04 +0000 |
| commit | 4e02b95eeac1cdd3d49f0ca0177f9d59a76e9ce4 (patch) | |
| tree | d315abd8ce2021a0dfa7668b8ac2e5b01b403230 /src/slskd/Program.cs | |
| parent | 1f98acd90622a66f0ec4a88f5c0c60c8a1cdd332 (diff) | |
| download | slskd-4e02b95eeac1cdd3d49f0ca0177f9d59a76e9ce4.tar.gz | |
Add handling for AbandonedMutexException from WaitOne call
Co-authored-by: jpdillingham <17145758+jpdillingham@users.noreply.github.com>
Diffstat (limited to 'src/slskd/Program.cs')
| -rw-r--r-- | src/slskd/Program.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 098cc324..bafac8b1 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -357,6 +357,13 @@ namespace slskd Log.Warning("This can happen when running with insufficient permissions"); Log.Warning("The application will continue, but multiple instances may be able to run simultaneously"); } + catch (AbandonedMutexException ex) + { + Log.Warning($"Acquired an abandoned mutex: {ex.Message}"); + Log.Warning("A previous instance may have terminated unexpectedly"); + + // The mutex is now owned by this thread, so we can continue + } // derive the application directory value and defaults that are dependent upon it AppDirectory ??= DefaultAppDirectory; |
