merged set_settings race condition fix into trunk
This commit is contained in:
parent
d7a3e823b5
commit
9024209d51
|
@ -44,7 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/shared_array.hpp>
|
||||
#include <deque>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/disk_buffer_pool.hpp"
|
||||
|
||||
|
|
|
@ -1751,20 +1751,22 @@ namespace libtorrent
|
|||
m_log << log_time() << " update_settings " << std::endl;
|
||||
#endif
|
||||
TORRENT_ASSERT(j.buffer);
|
||||
session_settings const& s = *((session_settings*)j.buffer);
|
||||
TORRENT_ASSERT(s.cache_size >= 0);
|
||||
TORRENT_ASSERT(s.cache_expiry > 0);
|
||||
session_settings const* s = ((session_settings*)j.buffer);
|
||||
TORRENT_ASSERT(s->cache_size >= 0);
|
||||
TORRENT_ASSERT(s->cache_expiry > 0);
|
||||
|
||||
#if defined TORRENT_WINDOWS
|
||||
if (m_settings.low_prio_disk != s.low_prio_disk)
|
||||
if (m_settings.low_prio_disk != s->low_prio_disk)
|
||||
{
|
||||
m_file_pool.set_low_prio_io(s.low_prio_disk);
|
||||
m_file_pool.set_low_prio_io(s->low_prio_disk);
|
||||
// we need to close all files, since the prio
|
||||
// only takes affect when files are opened
|
||||
m_file_pool.release(0);
|
||||
}
|
||||
#endif
|
||||
m_settings = s;
|
||||
m_settings = *s;
|
||||
delete s;
|
||||
|
||||
m_file_pool.resize(m_settings.file_pool_size);
|
||||
#if defined __APPLE__ && defined __MACH__ && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||
setiopolicy_np(IOPOL_TYPE_DISK, IOPOL_SCOPE_THREAD
|
||||
|
|
|
@ -1865,7 +1865,7 @@ namespace aux {
|
|||
void session_impl::update_disk_thread_settings()
|
||||
{
|
||||
disk_io_job j;
|
||||
j.buffer = (char*)&m_settings;
|
||||
j.buffer = (char*)new session_settings(m_settings);
|
||||
j.action = disk_io_job::update_settings;
|
||||
m_disk_thread.add_job(j);
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ void run_elevator_test()
|
|||
session_settings set;
|
||||
set.use_read_cache = false;
|
||||
disk_io_job j;
|
||||
j.buffer = (char*)&set;
|
||||
j.buffer = (char*)new session_settings(set);
|
||||
j.action = disk_io_job::update_settings;
|
||||
dio.add_job(j);
|
||||
|
||||
|
@ -382,7 +382,7 @@ void run_elevator_test()
|
|||
|
||||
// test disabling disk-reordering
|
||||
set.allow_reordered_disk_operations = false;
|
||||
j.buffer = (char*)&set;
|
||||
j.buffer = (char*)new session_settings(set);
|
||||
j.action = disk_io_job::update_settings;
|
||||
dio.add_job(j);
|
||||
|
||||
|
|
Loading…
Reference in New Issue