Author: alanmc
Date: 2008-02-14 16:12:41 -0500 (Thu, 14 Feb 2008)
New Revision: 95699
Modified:
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/DiskManager.cs
Log:
Added locks where necessary
Modified:
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/DiskManager.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/DiskManager.cs
2008-02-14 21:12:04 UTC (rev 95698)
+++ trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/DiskManager.cs
2008-02-14 21:12:41 UTC (rev 95699)
@@ -123,7 +123,7 @@
int index = data.BlockIndex;
// Perform the actual write
- using (new ReaderLock(this.streamsLock))
+ lock (writer)
writer.Write(data);
piece.Blocks[index].Written = true;
@@ -167,14 +167,16 @@
/// <param name="bufferedFileIO"></param>
private void PerformRead(BufferedFileRead io)
{
- io.BytesRead = writer.Read(io.Manager, io.Buffer, io.BufferOffset,
io.PieceStartIndex, io.Count);
+ lock (writer)
+ io.BytesRead = writer.Read(io.Manager, io.Buffer,
io.BufferOffset, io.PieceStartIndex, io.Count);
io.WaitHandle.Set();
}
internal int Read(FileManager fileManager, byte[] buffer, int
bufferOffset, long pieceStartIndex, int bytesToRead)
{
- return writer.Read(fileManager, buffer, bufferOffset,
pieceStartIndex, bytesToRead);
+ lock (writer)
+ return writer.Read(fileManager, buffer, bufferOffset,
pieceStartIndex, bytesToRead);
}
/// <summary>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches