You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "James Clampffer (JIRA)" <ji...@apache.org> on 2016/06/28 20:24:57 UTC

[jira] [Resolved] (HDFS-9326) Create a generic function to synchronize async functions and methods.

     [ https://issues.apache.org/jira/browse/HDFS-9326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Clampffer resolved HDFS-9326.
-----------------------------------
       Resolution: Won't Fix
         Assignee: James Clampffer
    Fix Version/s: HDFS-8707

Closing this bug without a fix.  It's not required and there doesn't seem to be a good solution that works on compilers more than a year or so old.

> Create a generic function to synchronize async functions and methods. 
> ----------------------------------------------------------------------
>
>                 Key: HDFS-9326
>                 URL: https://issues.apache.org/jira/browse/HDFS-9326
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs-client
>            Reporter: James Clampffer
>            Assignee: James Clampffer
>             Fix For: HDFS-8707
>
>
> The majority of the functionality in libhdfs++ is asynchronous, but some applications need synchronous operations.  At the time of filing this only happens in 3 places in the C API, however that number is going to grow a lot once the C and high level C++ APIs expose all of the namenode functions.
> This synchronization is typically implemented like this:
> auto promise = std::make_shared<std::promise<T>>()
> std::future<T> = future(promise->get_future());
> auto async_callback = [promise] () {promise->set_value(val);};
> SomeClass::AsyncMethod(async_callback); 
> auto result = future.get()
> Ideally this could all be pushed into a templated function so that the promise and future don't need to be defined at the call site.  This would probably take the form of doing a std::bind to get all the arguments in place at the call site and then passing that to the synchronize function.
> This appears to require some template magic that isn't always well supported; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51979.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org