Namespaces | Functions | Variables

function_call_dispatch.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  graphlab
 

The namespace containing all graphlab objects and functions.


Functions

 graphlab::dc_impl::BOOST_PP_REPEAT (6, DISPATCH_GENERATOR, _) BOOST_PP_REPEAT(6

Variables

 graphlab::dc_impl::NONINTRUSIVE_DISPATCH_GENERATOR

Detailed Description

This is an internal function and should not be used directly

A "call" is an RPC which is performed asynchronously. There are 2 types of calls. A "basic" call calls a standard C/C++ function and does not require the function to be modified. while the "regular" call requires the first 2 arguments of the function to be "distributed_control &dc, procid_t source".

A "dispatch" is a wrapper function on the receiving side of an RPC which decodes the packet and performs the function call.

This scary looking piece of code is actually quite straightforward. Given function F, as well as input types T1 ... Tn it will construct an input archive and deserialize the types T1.... Tn, and call the function f with it. This code dispatches to the "intrusive" form of a function call (that is the function call must take a distributed_control and a "procid_t source" as its first 2 arguments.

For instance, the 1 argument version of this is DISPATCH1:

template<typename DcType, 
        typename F , 
        typename T0> void DISPATCH1 (DcType& dc, 
                                     procid_t source, 
                                     unsigned char packet_type_mask, 
                                     std::istream &strm)
{
    iarchive iarc(strm);
    size_t s;
    iarc >> s;
    F f = reinterpret_cast<F>(s);
    T0 (f0) ;
    iarc >> (f0) ;
    f(dc, source , (f0) );
    charstring_free(f0);
}

charstring_free is a special template function which calls free(f1) only if f1 is a character array (char*)

And similarly, the non-intrusive dispatch a little below

Note that the template around DcType is *deliberate*. This prevents this function from instantiating the distributed_control until as late as possible, avoiding problems with circular references.

Definition in file function_call_dispatch.hpp.