server.cpp 510 Bytes
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <iostream>
#include <thallium.hpp>
#include "point.hpp"

namespace tl = thallium;

int main(int argc, char** argv) {

    tl::engine myEngine("bmi+tcp://127.0.0.1:1234", THALLIUM_SERVER_MODE);

    std::function<void(const tl::request&, const point&, const point&)> dot_product = 
        [&myEngine](const tl::request& req, const point& p, const point& q) {
            req.respond(p*q);
            myEngine.finalize();
        };

    myEngine.define("dot_product", dot_product);

    return 0;
}