You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Igor Sapego (JIRA)" <ji...@apache.org> on 2017/04/18 18:01:41 UTC
[jira] [Commented] (IGNITE-1439) CPP: Implement futures.
[ https://issues.apache.org/jira/browse/IGNITE-1439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15973180#comment-15973180 ]
Igor Sapego commented on IGNITE-1439:
-------------------------------------
Implemented prototype for Windows. As we have to support Windows XP I can't use Condition Variables (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682052(v=vs.85).aspx), which would be perfect for cross-platform solution. So instead I used Manual-reset Event objects (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682655(v=vs.85).aspx) and critical sections. Current implementation seems to be correct though I have not tested it properly yet.
Some details of current implementation:
To create {{Future}} one needs to first create {{Promise}} object. {{Promise}} is object which used to set value or error for the linked {{Future}} objects.
Once {{Promise}} created, one can call {{Promise::GetFuture()}} to get instance of related {{Future}} object. There may be unlimited number of futures for every {{Promise}}. {{Promise}} can't be copied though. Error or value can be set only once for the {{Promise}}. If someone tries to set value or error to a set {{Promise}} this will result in exception. If {{Promise}} instance gets destructed before any value or error has been set error is automatically set for all linked {{Future}} objects.
On any {{Future}} object user can call either {{Wait}}, {{WaitFor}} or {{Get}} methods. All these methods are blocking. If {{Get}} called on future for which error has been set this will result in exception.
Obviously enough, {{Future}} class is a part of public API, while {{Promise}} is internal class.
> CPP: Implement futures.
> -----------------------
>
> Key: IGNITE-1439
> URL: https://issues.apache.org/jira/browse/IGNITE-1439
> Project: Ignite
> Issue Type: Task
> Components: platforms
> Affects Versions: 1.1.4
> Reporter: Vladimir Ozerov
> Assignee: Igor Sapego
> Labels: cpp
> Fix For: 2.1
>
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)