support calling API functions from plugins

This commit is contained in:
Arvid Norberg 2013-08-13 03:18:11 +00:00
parent fdeab204a4
commit 6228ef2e85
1 changed files with 8 additions and 8 deletions

View File

@ -194,7 +194,7 @@ namespace libtorrent
session_impl& ses = t->session(); \ session_impl& ses = t->session(); \
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t)))); \ ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t)))); \
do { ses.cond.wait(l); } while(!done) while (!done) { ses.cond.wait(l); }
#define TORRENT_SYNC_CALL1(x, a1) \ #define TORRENT_SYNC_CALL1(x, a1) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -204,7 +204,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1)))); \ ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done); } while (!done) { ses.cond.wait(l); }; }
#define TORRENT_SYNC_CALL2(x, a1, a2) \ #define TORRENT_SYNC_CALL2(x, a1, a2) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -214,7 +214,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1, a2)))); \ ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1, a2)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done); } while (!done) { ses.cond.wait(l); }; }
#define TORRENT_SYNC_CALL3(x, a1, a2, a3) \ #define TORRENT_SYNC_CALL3(x, a1, a2, a3) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -224,7 +224,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1, a2, a3)))); \ ses.m_io_service.dispatch(boost::bind(&fun_wrap, &done, &ses.cond, &ses.mut, boost::function<void(void)>(boost::bind(&torrent:: x, t, a1, a2, a3)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done); } while (!done) { ses.cond.wait(l); }; }
#define TORRENT_SYNC_CALL_RET(type, def, x) \ #define TORRENT_SYNC_CALL_RET(type, def, x) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -235,7 +235,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t)))); \ ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done) while (!done) { ses.cond.wait(l); }
#define TORRENT_SYNC_CALL_RET1(type, def, x, a1) \ #define TORRENT_SYNC_CALL_RET1(type, def, x, a1) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -246,7 +246,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t, a1)))); \ ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t, a1)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done) while (!done) { ses.cond.wait(l); }
#define TORRENT_SYNC_CALL_RET2(type, def, x, a1, a2) \ #define TORRENT_SYNC_CALL_RET2(type, def, x, a1, a2) \
boost::shared_ptr<torrent> t = m_torrent.lock(); \ boost::shared_ptr<torrent> t = m_torrent.lock(); \
@ -257,7 +257,7 @@ namespace libtorrent
mutex::scoped_lock l(ses.mut); \ mutex::scoped_lock l(ses.mut); \
ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t, a1, a2)))); \ ses.m_io_service.dispatch(boost::bind(&fun_ret<type >, &r, &done, &ses.cond, &ses.mut, boost::function<type(void)>(boost::bind(&torrent:: x, t, a1, a2)))); \
t.reset(); \ t.reset(); \
do { ses.cond.wait(l); } while(!done) while (!done) { ses.cond.wait(l); }
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
void throw_invalid_handle() void throw_invalid_handle()
@ -871,7 +871,7 @@ namespace libtorrent
, &ses.mut, boost::function<void(void)>(boost::bind( , &ses.mut, boost::function<void(void)>(boost::bind(
&piece_manager::write_resume_data, &t->filesystem(), boost::ref(ret))))); &piece_manager::write_resume_data, &t->filesystem(), boost::ref(ret)))));
t.reset(); t.reset();
do { ses.cond.wait(l); } while(!done); while (!done) { ses.cond.wait(l); }
} }
return ret; return ret;