thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amir Taaki <>
Subject Yielding service handler methods in C++
Date Fri, 30 Nov 2012 11:30:27 GMT

I'd like to have my service handler make an async request and then return the result once
it's ready.

Currently you have something like:

int32_t add(const int32_t n1, const int32_t n2)
    int32_t result = do_something(n1, n2);

    return result;


I want to be able to do something like:

void add(Result& result, const int32_t n1, const int32_t n2)
    // function call returns immediately

    do_something(result, n1, n2);

The operation 'add' is added to a stack, and then a worker thread picks it up, computes the
result and finally gives it back to thrift so it can be sent to the client.

Otherwise I'd have to use futures and promises which isn't the best solution if thrift supports
async natively.

BTW are there any libthrift C++ packages. I saw only Java and Python bindings so I was confused
why the core library is missing.

View raw message