Browse Source

Backported r4826 "Fixed race condition that was causing unit tests to fail" to 3.1

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5309 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
David Srbecký 16 years ago
parent
commit
4ad43957db
  1. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs
  2. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.cs

@ -157,12 +157,18 @@ namespace Debugger @@ -157,12 +157,18 @@ namespace Debugger
process.Start();
}
internal object ProcessIsBeingCreatedLock = new object();
public Process Start(string filename, string workingDirectory, string arguments)
{
InitDebugger(GetProgramVersion(filename));
Process process = Process.CreateProcess(this, filename, workingDirectory, arguments);
AddProcess(process);
return process;
lock(ProcessIsBeingCreatedLock) {
Process process = Process.CreateProcess(this, filename, workingDirectory, arguments);
// Expose a race conditon
System.Threading.Thread.Sleep(0);
AddProcess(process);
return process;
}
}
public Process Attach(System.Diagnostics.Process existingProcess)

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallbackSwitch.cs

@ -73,7 +73,11 @@ namespace Debugger @@ -73,7 +73,11 @@ namespace Debugger
public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugProcess pProcess)
{
Process process = debugger.GetProcess(pProcess);
Process process;
// We have to wait until the created process is added into the collection
lock(debugger.ProcessIsBeingCreatedLock) {
process = debugger.GetProcess(pProcess);
}
// Make *really* sure the process is not dead
if (process == null) {
debugger.TraceMessage("Ignoring callback \"" + name + "\": Process not found");

Loading…
Cancel
Save