Commit 932d68b6 authored by Matthieu Dorier's avatar Matthieu Dorier

replaced ignore_reponse with disable_response

parent 46ecd386
......@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
exit(0);
}
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::remote_procedure hello = myEngine.define("hello").ignore_response();
tl::remote_procedure hello = myEngine.define("hello").disable_response();
tl::endpoint server = myEngine.lookup(argv[1]);
hello.on(server)();
......
......@@ -10,8 +10,8 @@ void hello(const tl::request& req) {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
myEngine.define("hello", hello).ignore_response();
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("hello", hello).disable_response();
return 0;
}
......
......@@ -11,7 +11,7 @@ void sum(const tl::request& req, int x, int y) {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("sum", sum);
return 0;
......
......@@ -6,7 +6,7 @@ namespace tl = thallium;
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
std::function<void(const tl::request&, int, int)> sum =
[](const tl::request& req, int x, int y) {
......
......@@ -6,7 +6,7 @@ namespace tl = thallium;
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
std::function<void(const tl::request&, int, int)> sum =
[&myEngine](const tl::request& req, int x, int y) {
......
......@@ -10,7 +10,7 @@ int main(int argc, char** argv) {
exit(0);
}
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::remote_procedure hello = myEngine.define("hello").ignore_response();
tl::remote_procedure hello = myEngine.define("hello").disable_response();
tl::endpoint server = myEngine.lookup(argv[1]);
std::string name = "Matthieu";
hello.on(server)(name);
......
......@@ -12,8 +12,8 @@ void hello(const tl::request& req, const std::string& name) {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
myEngine.define("hello", hello).ignore_response();
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("hello", hello).disable_response();
return 0;
}
......
......@@ -7,7 +7,7 @@ namespace tl = thallium;
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
std::function<void(const tl::request&, const point&, const point&)> dot_product =
[&myEngine](const tl::request& req, const point& p, const point& q) {
......
......@@ -9,7 +9,7 @@ int main(int argc, char** argv) {
exit(0);
}
tl::engine myEngine("tcp", MARGO_CLIENT_MODE);
tl::remote_procedure remote_do_rdma = myEngine.define("do_rdma").ignore_response();
tl::remote_procedure remote_do_rdma = myEngine.define("do_rdma");
tl::endpoint server_endpoint = myEngine.lookup(argv[1]);
std::string buffer = "Matthieu";
......
......@@ -7,7 +7,7 @@ namespace tl = thallium;
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
std::function<void(const tl::request&, tl::bulk&)> f =
[&myEngine](const tl::request& req, tl::bulk& b) {
......@@ -21,7 +21,8 @@ int main(int argc, char** argv) {
std::cout << "Server received bulk: ";
for(auto c : v) std::cout << c;
std::cout << std::endl;
req.respond(1);
};
myEngine.define("do_rdma",f).ignore_response();
myEngine.define("do_rdma",f);
}
......@@ -11,7 +11,7 @@ void sum(const tl::request& req, int x, int y) {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_SERVER_MODE);
std::cout << "Server running at address " << (std::string)myEngine.self() << std::endl;
std::cout << "Server running at address " << myEngine.self() << std::endl;
myEngine.define("sum", sum);
return 0;
......
......@@ -12,8 +12,8 @@ int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::remote_procedure sum = myEngine.define("sum");
tl::remote_procedure prod = myEngine.define("prod");
tl::remote_procedure hello = myEngine.define("hello").ignore_response();
tl::remote_procedure print = myEngine.define("print").ignore_response();
tl::remote_procedure hello = myEngine.define("hello").disable_response();
tl::remote_procedure print = myEngine.define("print").disable_response();
tl::endpoint server = myEngine.lookup(argv[1]);
uint16_t provider_id = atoi(argv[2]);
tl::provider_handle ph(server, provider_id);
......
......@@ -33,7 +33,7 @@ class my_sum_provider : public tl::provider<my_sum_provider> {
: tl::provider<my_sum_provider>(e, provider_id) {
define("prod", &my_sum_provider::prod);
define("sum", &my_sum_provider::sum);
define("hello", &my_sum_provider::hello);
define("hello", &my_sum_provider::hello).disable_response();
define("print", &my_sum_provider::print, tl::ignore_return_value());
}
......
......@@ -90,33 +90,33 @@ public:
* @param T::*func member function
*/
template<typename S, typename R, typename ... Args>
void define(S&& name, R(T::*func)(const request&, Args...)) {
remote_procedure define(S&& name, R(T::*func)(const request&, Args...)) {
T* self = dynamic_cast<T*>(this);
std::function<void(const request&, Args...)> fun = [self, func](const request& r, Args... args) {
(self->*func)(r, args...);
};
m_engine.define(std::forward<S>(name), fun, m_provider_id);
return m_engine.define(std::forward<S>(name), fun, m_provider_id);
}
private:
template<typename S, typename R, typename ... Args>
void define_member(S&& name, R(T::*func)(Args...), const std::integral_constant<bool, false>&) {
remote_procedure define_member(S&& name, R(T::*func)(Args...), const std::integral_constant<bool, false>&) {
T* self = dynamic_cast<T*>(this);
std::function<void(const request&, Args...)> fun = [self, func](const request& req, Args... args) {
R r = (self->*func)(args...);
req.respond(r);
};
m_engine.define(std::forward<S>(name), fun, m_provider_id);
return m_engine.define(std::forward<S>(name), fun, m_provider_id);
}
template<typename S, typename R, typename ... Args>
void define_member(S&& name, R(T::*func)(Args...), const std::integral_constant<bool, true>&) {
remote_procedure define_member(S&& name, R(T::*func)(Args...), const std::integral_constant<bool, true>&) {
T* self = dynamic_cast<T*>(this);
std::function<void(const request&, Args...)> fun = [self, func](const request& req, Args... args) {
(self->*func)(args...);
};
m_engine.define(std::forward<S>(name), fun, m_provider_id).ignore_response();
return m_engine.define(std::forward<S>(name), fun, m_provider_id).disable_response();
}
protected:
......@@ -138,8 +138,8 @@ protected:
* @param T::*func Member function.
*/
template<typename S, typename R, typename ... Args, typename X = typename std::is_void<R>::type>
inline void define(S&& name, R(T::*func)(Args...), X x = X()) {
define_member(std::forward<S>(name), func, x);
inline remote_procedure define(S&& name, R(T::*func)(Args...), X x = X()) {
return define_member(std::forward<S>(name), func, x);
}
public:
......
......@@ -93,7 +93,12 @@ public:
*
* @return *this
*/
remote_procedure& ignore_response();
remote_procedure& disable_response();
[[deprecated("use disable_response() instead")]]
inline remote_procedure& ignore_response() {
return disable_response();
}
};
......
......@@ -21,7 +21,7 @@ callable_remote_procedure remote_procedure::on(const provider_handle& ph) const
return callable_remote_procedure(*m_engine, m_id, ph, m_ignore_response, ph.provider_id());
}
remote_procedure& remote_procedure::ignore_response() {
remote_procedure& remote_procedure::disable_response() {
m_ignore_response = true;
margo_registered_disable_response(m_engine->m_mid, m_id, HG_TRUE);
return *this;
......
......@@ -11,13 +11,13 @@ namespace tl = thallium;
int client() {
tl::engine margo("bmi+tcp", MARGO_CLIENT_MODE);
auto remote_send = margo.define("send_bulk").ignore_response();
auto remote_stop = margo.define("stop").ignore_response();
auto remote_send = margo.define("send_bulk").disable_response();
auto remote_stop = margo.define("stop").disable_response();
std::string server_addr = "bmi+tcp://127.0.0.1:1234";
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
std::cout << "Lookup done for endpoint " << server_endpoint << std::endl;
std::string buf = "Matthieu";
std::vector<std::pair<void*,std::size_t>> seg(1);
......
......@@ -25,7 +25,7 @@ int server() {
for(auto c : v) std::cout << c;
std::cout << std::endl;
};
margo.define("send_bulk",f).ignore_response();
margo.define("send_bulk",f).disable_response();
std::function<void(const tl::request&)> g =
[&margo](const tl::request& req) {
......
......@@ -11,14 +11,14 @@ namespace tl = thallium;
int client(const char* addr) {
tl::engine margo("tcp", MARGO_CLIENT_MODE);
auto remote_hello = margo.define("hello").ignore_response();
auto remote_hello = margo.define("hello").disable_response();
auto remote_sum = margo.define("sum");
auto remote_stop = margo.define("stop").ignore_response();
auto remote_stop = margo.define("stop").disable_response();
std::string server_addr = addr;
sleep(1);
auto server_endpoint = margo.lookup(server_addr);
std::cout << "Lookup done for endpoint " << (std::string)server_endpoint << std::endl;
std::cout << "Lookup done for endpoint " << server_endpoint << std::endl;
remote_hello.on(server_endpoint)(std::string("Matt"));
......
......@@ -16,7 +16,7 @@ int server() {
tl::engine margo("tcp", MARGO_SERVER_MODE);
margo.define("hello", hello).ignore_response();
margo.define("hello", hello).disable_response();
std::function<void(const tl::request&, int, int)> f =
[](const tl::request& req, int x, int y) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment