From 0f6ec06e126371ae02c1af201a5d892c7c59d831 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 30 Sep 2008 01:16:19 +0000 Subject: [PATCH] fixed race condition in invariant check in disk io thread (only affected debug builds) --- src/disk_io_thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 901834634..31c60171f 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -636,10 +636,11 @@ namespace libtorrent TORRENT_ASSERT(j.buffer_size <= m_block_size); mutex_t::scoped_lock l(m_queue_mutex); #ifndef NDEBUG + mutex_t::scoped_lock l2(m_piece_mutex); if (j.action == disk_io_job::write) { cache_t::iterator p - = find_cached_piece(m_pieces, j, l); + = find_cached_piece(m_pieces, j, l2); if (p != m_pieces.end()) { int block = j.offset / m_block_size;