8 changed files with 13 additions and 153 deletions
@ -1,12 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
|
|
||||||
namespace ICSharpCode.Scripting |
|
||||||
{ |
|
||||||
public interface ILock : IDisposable |
|
||||||
{ |
|
||||||
} |
|
||||||
} |
|
@ -1,35 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Threading; |
|
||||||
|
|
||||||
namespace ICSharpCode.Scripting |
|
||||||
{ |
|
||||||
public class StringListLock : ILock |
|
||||||
{ |
|
||||||
List<string> lines; |
|
||||||
|
|
||||||
public StringListLock(List<string> lines) |
|
||||||
{ |
|
||||||
this.lines = lines; |
|
||||||
Lock(); |
|
||||||
} |
|
||||||
|
|
||||||
void Lock() |
|
||||||
{ |
|
||||||
Monitor.Enter(lines); |
|
||||||
} |
|
||||||
|
|
||||||
public void Dispose() |
|
||||||
{ |
|
||||||
Unlock(); |
|
||||||
} |
|
||||||
|
|
||||||
void Unlock() |
|
||||||
{ |
|
||||||
Monitor.Exit(lines); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,29 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using ICSharpCode.Scripting; |
|
||||||
|
|
||||||
namespace ICSharpCode.Scripting.Tests.Utils |
|
||||||
{ |
|
||||||
public class FakeLock : ILock |
|
||||||
{ |
|
||||||
public List<string> Lines; |
|
||||||
public bool IsDisposed; |
|
||||||
public int UnreadLineCountWhenLockCreated = -1; |
|
||||||
public int UnreadLineCountWhenLockDisposed = -1; |
|
||||||
|
|
||||||
public FakeLock(List<string> lines) |
|
||||||
{ |
|
||||||
this.Lines = lines; |
|
||||||
UnreadLineCountWhenLockCreated = lines.Count; |
|
||||||
} |
|
||||||
|
|
||||||
public void Dispose() |
|
||||||
{ |
|
||||||
UnreadLineCountWhenLockDisposed = Lines.Count; |
|
||||||
IsDisposed = true; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue