diff options
author | Jason Imison <nosami@users.noreply.github.com> | 2022-07-20 16:55:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 16:55:31 +0300 |
commit | 9c3ed66d0b0e795c89346aafd0b3095c6a1b06b8 (patch) | |
tree | 2ad84f16a02a5c2db91167aa41d0dcd569c43fcb | |
parent | 7bda4714d11e86bd878f446b3d484c592d9324f2 (diff) | |
parent | 3970e475265a3ee4244bb4cb41eafd450ca686f4 (diff) |
Merge pull request #371 from mono/dev/nosami/debugger-locks
Remove nested locks on slock
-rw-r--r-- | Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs | 220 |
1 files changed, 100 insertions, 120 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs b/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs index c6a0fee..9b38e5a 100644 --- a/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs +++ b/Mono.Debugging/Mono.Debugging.Client/DebuggerSession.cs @@ -409,22 +409,20 @@ namespace Mono.Debugging.Client throw new ArgumentNullException (nameof (startInfo)); if (options == null) throw new ArgumentNullException (nameof (options)); - - lock (slock) { - this.options = options; - OnRunning (); - Dispatch (delegate { - try { - OnRun (startInfo); - } catch (Exception ex) { - // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state - var exceptionHandled = HandleException (ex); - ForceExit (); - if (!exceptionHandled) - throw; - } - }); - } + + Dispatch (delegate { + try { + this.options = options; + OnRunning (); + OnRun (startInfo); + } catch (Exception ex) { + // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state + var exceptionHandled = HandleException (ex); + ForceExit (); + if (!exceptionHandled) + throw; + } + }); } /// <summary> @@ -445,23 +443,21 @@ namespace Mono.Debugging.Client throw new ArgumentNullException (nameof (proc)); if (options == null) throw new ArgumentNullException (nameof (options)); - - lock (slock) { - this.options = options; - OnRunning (); - Dispatch (delegate { - try { - OnAttachToProcess (proc); - attached = true; - } catch (Exception ex) { - // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state - var exceptionHandled = HandleException (ex); - ForceExit (); - if (!exceptionHandled) - throw; - } - }); - } + + Dispatch (delegate { + try { + this.options = options; + OnRunning (); + OnAttachToProcess (proc); + attached = true; + } catch (Exception ex) { + // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state + var exceptionHandled = HandleException (ex); + ForceExit (); + if (!exceptionHandled) + throw; + } + }); } /// <summary> @@ -469,20 +465,16 @@ namespace Mono.Debugging.Client /// </summary> public void Detach () { - lock (slock) { - Dispatch (delegate { - try { - OnDetach (); - } - catch (Exception ex) { - if (!HandleException (ex)) - throw; - } - finally { - IsConnected = false; - } - }); - } + Dispatch (delegate { + try { + OnDetach (); + } catch (Exception ex) { + if (!HandleException (ex)) + throw; + } finally { + IsConnected = false; + } + }); } /// <summary> @@ -529,19 +521,17 @@ namespace Mono.Debugging.Client /// </summary> public void NextLine () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - StartStepTimer (StepOverStats); - try { - OnNextLine (); - } catch (Exception ex) { - ForceStop (); - if (!HandleException (ex)) - throw; - } - }); - } + StartStepTimer (StepOverStats); + try { + OnNextLine (); + } catch (Exception ex) { + ForceStop (); + if (!HandleException (ex)) + throw; + } + }); } /// <summary> @@ -549,19 +539,17 @@ namespace Mono.Debugging.Client /// </summary> public void StepLine () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - StartStepTimer (StepInStats); - try { - OnStepLine (); - } catch (Exception ex) { - ForceStop (); - if (!HandleException (ex)) - throw; - } - }); - } + StartStepTimer (StepInStats); + try { + OnStepLine (); + } catch (Exception ex) { + ForceStop (); + if (!HandleException (ex)) + throw; + } + }); } /// <summary> @@ -569,19 +557,17 @@ namespace Mono.Debugging.Client /// </summary> public void NextInstruction () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - StartStepTimer (NextInstructionStats); - try { - OnNextInstruction (); - } catch (Exception ex) { - ForceStop (); - if (!HandleException (ex)) - throw; - } - }); - } + StartStepTimer (NextInstructionStats); + try { + OnNextInstruction (); + } catch (Exception ex) { + ForceStop (); + if (!HandleException (ex)) + throw; + } + }); } /// <summary> @@ -589,19 +575,17 @@ namespace Mono.Debugging.Client /// </summary> public void StepInstruction () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - StartStepTimer (StepInstructionStats); - try { - OnStepInstruction (); - } catch (Exception ex) { - ForceStop (); - if (!HandleException (ex)) - throw; - } - }); - } + StartStepTimer (StepInstructionStats); + try { + OnStepInstruction (); + } catch (Exception ex) { + ForceStop (); + if (!HandleException (ex)) + throw; + } + }); } /// <summary> @@ -609,21 +593,19 @@ namespace Mono.Debugging.Client /// </summary> public void Finish () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - StartStepTimer (StepOutStats); - try { - OnFinish (); - } catch (Exception ex) { - // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state - var exceptionHandled = HandleException (ex); - ForceExit (); - if (!exceptionHandled) - throw; - } - }); - } + StartStepTimer (StepOutStats); + try { + OnFinish (); + } catch (Exception ex) { + // should handle exception before raising Exit event because HandleException may ignore exceptions in Exited state + var exceptionHandled = HandleException (ex); + ForceExit (); + if (!exceptionHandled) + throw; + } + }); } /// <summary> @@ -864,18 +846,16 @@ namespace Mono.Debugging.Client /// </summary> public void Continue () { - lock (slock) { + Dispatch (delegate { OnRunning (); - Dispatch (delegate { - try { - OnContinue (); - } catch (Exception ex) { - ForceStop (); - if (!HandleException (ex)) - throw; - } - }); - } + try { + OnContinue (); + } catch (Exception ex) { + ForceStop (); + if (!HandleException (ex)) + throw; + } + }); } /// <summary> |