forked from premiere/premiere-libtorrent
fixed threading problem in file_pool
This commit is contained in:
parent
1fd3216e6c
commit
79cfdb609f
|
@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
@ -95,6 +96,7 @@ namespace libtorrent
|
|||
> file_set;
|
||||
|
||||
file_set m_files;
|
||||
boost::mutex m_mutex;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace libtorrent
|
|||
{
|
||||
assert(st != 0);
|
||||
assert(p.is_complete());
|
||||
boost::mutex::scoped_lock l(m_mutex);
|
||||
typedef nth_index<file_set, 0>::type path_view;
|
||||
path_view& pt = get<0>(m_files);
|
||||
path_view::iterator i = pt.find(p);
|
||||
|
@ -93,6 +94,7 @@ namespace libtorrent
|
|||
|
||||
void file_pool::release(void* st)
|
||||
{
|
||||
boost::mutex::scoped_lock l(m_mutex);
|
||||
assert(st != 0);
|
||||
using boost::tie;
|
||||
|
||||
|
@ -108,6 +110,7 @@ namespace libtorrent
|
|||
{
|
||||
assert(size > 0);
|
||||
if (size == m_size) return;
|
||||
boost::mutex::scoped_lock l(m_mutex);
|
||||
m_size = size;
|
||||
if (int(m_files.size()) <= m_size) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue