diff --git a/src/session.cpp b/src/session.cpp index 72d010283..b59b16159 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -321,13 +321,13 @@ namespace libtorrent } #define TORRENT_ASYNC_CALL(x) \ - m_impl->m_io_service.post(boost::bind(&session_impl:: x, m_impl.get())) + m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get())) #define TORRENT_ASYNC_CALL1(x, a1) \ - m_impl->m_io_service.post(boost::bind(&session_impl:: x, m_impl.get(), a1)) + m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1)) #define TORRENT_ASYNC_CALL2(x, a1, a2) \ - m_impl->m_io_service.post(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)) + m_impl->m_io_service.dispatch(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)) #define TORRENT_WAIT \ mutex::scoped_lock l(m_impl->mut); \ @@ -335,51 +335,51 @@ namespace libtorrent #define TORRENT_SYNC_CALL(x) \ bool done = false; \ - m_impl->m_io_service.post(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get())))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get())))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL1(x, a1) \ bool done = false; \ - m_impl->m_io_service.post(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL2(x, a1, a2) \ bool done = false; \ - m_impl->m_io_service.post(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL3(x, a1, a2, a3) \ bool done = false; \ - m_impl->m_io_service.post(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL4(x, a1, a2, a3, a4) \ bool done = false; \ - m_impl->m_io_service.post(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3, a4)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_wrap, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3, a4)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL_RET(type, x) \ bool done = false; \ type r; \ - m_impl->m_io_service.post(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get())))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get())))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL_RET1(type, x, a1) \ bool done = false; \ type r; \ - m_impl->m_io_service.post(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL_RET2(type, x, a1, a2) \ bool done = false; \ type r; \ - m_impl->m_io_service.post(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2)))); \ TORRENT_WAIT #define TORRENT_SYNC_CALL_RET3(type, x, a1, a2, a3) \ bool done = false; \ type r; \ - m_impl->m_io_service.post(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3)))); \ + m_impl->m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &m_impl->cond, &m_impl->mut, boost::function(boost::bind(&session_impl:: x, m_impl.get(), a1, a2, a3)))); \ TORRENT_WAIT #ifndef TORRENT_CFG diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index f41d725e0..a9db6f0fd 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -162,31 +162,31 @@ namespace libtorrent boost::shared_ptr t = m_torrent.lock(); \ if (!t) return; \ session_impl& ses = t->session(); \ - ses.m_io_service.post(boost::bind(&torrent:: x, t)) + ses.m_io_service.dispatch(boost::bind(&torrent:: x, t)) #define TORRENT_ASYNC_CALL1(x, a1) \ boost::shared_ptr t = m_torrent.lock(); \ if (!t) return; \ session_impl& ses = t->session(); \ - ses.m_io_service.post(boost::bind(&torrent:: x, t, a1)) + ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1)) #define TORRENT_ASYNC_CALL2(x, a1, a2) \ boost::shared_ptr t = m_torrent.lock(); \ if (!t) return; \ session_impl& ses = t->session(); \ - ses.m_io_service.post(boost::bind(&torrent:: x, t, a1, a2)) + ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2)) #define TORRENT_ASYNC_CALL3(x, a1, a2, a3) \ boost::shared_ptr t = m_torrent.lock(); \ if (!t) return; \ session_impl& ses = t->session(); \ - ses.m_io_service.post(boost::bind(&torrent:: x, t, a1, a2, a3)) + ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2, a3)) #define TORRENT_ASYNC_CALL4(x, a1, a2, a3, a4) \ boost::shared_ptr t = m_torrent.lock(); \ if (!t) return; \ session_impl& ses = t->session(); \ - ses.m_io_service.post(boost::bind(&torrent:: x, t, a1, a2, a3, a4)) + ses.m_io_service.dispatch(boost::bind(&torrent:: x, t, a1, a2, a3, a4)) #define TORRENT_SYNC_CALL(x) \ boost::shared_ptr t = m_torrent.lock(); \ @@ -194,7 +194,7 @@ namespace libtorrent bool done = false; \ session_impl& ses = t->session(); \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t)))); \ do { ses.cond.wait(l); } while(!done) #define TORRENT_SYNC_CALL1(x, a1) \ @@ -203,7 +203,7 @@ namespace libtorrent bool done = false; \ session_impl& ses = t->session(); \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done); } @@ -213,7 +213,7 @@ namespace libtorrent bool done = false; \ session_impl& ses = t->session(); \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done); } @@ -223,7 +223,7 @@ namespace libtorrent bool done = false; \ session_impl& ses = t->session(); \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2, a3)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2, a3)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done); } @@ -234,7 +234,7 @@ namespace libtorrent session_impl& ses = t->session(); \ type r; \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done) @@ -245,7 +245,7 @@ namespace libtorrent session_impl& ses = t->session(); \ type r; \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done) @@ -256,7 +256,7 @@ namespace libtorrent session_impl& ses = t->session(); \ type r; \ mutex::scoped_lock l(ses.mut); \ - ses.m_io_service.post(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2)))); \ + ses.m_io_service.dispatch(boost::bind(&fun_ret, &r, &done, &ses.cond, &ses.mut, boost::function(boost::bind(&torrent:: x, t, a1, a2)))); \ t.reset(); \ do { ses.cond.wait(l); } while(!done) @@ -866,7 +866,7 @@ namespace libtorrent bool done = false; session_impl& ses = t->session(); mutex::scoped_lock l(ses.mut); - ses.m_io_service.post(boost::bind(&fun_wrap, &done, &ses.cond + ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond , &ses.mut, boost::function(boost::bind( &piece_manager::write_resume_data, &t->filesystem(), boost::ref(ret))))); t.reset();