[ 
https://issues.apache.org/jira/browse/IGNITE-1439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15978539#comment-15978539
 ] 

Igor Sapego edited comment on IGNITE-1439 at 4/21/17 11:22 AM:
---------------------------------------------------------------

[~ptupitsyn] this design actually comes from the C++ itself to utilize it 
destructor-based resource control. You may look at this this way:

{{SharedState}} is implementation of the needed functionality itself. This is 
something you would call {{FutureImpl}} in Java.

{{Future}} class is something that provides public API (read access) and holds 
shared pointer to implementation, thus preventing its destruction.

{{Promise}} class here is something for which you do not have analogue in 
managed programming languages. Basically, it's guard-class, which holds shared 
pointer to implementation just as {{Future}} but provides write access to it. 
Its main role is to guarantee that that threads waiting on {{Future}} gets 
released if something goes wrong - upon destruction it checks state of the 
{{SharedState}} class and if it is not marked as a completed yet, it sets it to 
error state, thus releasing all waiting threads.

As for naming - I used one which is commonly used in C++ community. 
(http://www.cplusplus.com/reference/future/future, 
http://www.cplusplus.com/reference/future/promise).

bq. Where does this come from? Windows XP is no longer supported even by 
Microsoft.
https://apacheignite.readme.io/docs/getting-started#section-prerequisites



was (Author: isapego):
[~ptupitsyn] this design actually comes from the C++ itself to utilize it 
destructor-based resource control. You may look at this this way: 
{{SharedState}} is implementation of the needed functionality itself. This is 
something you would call {{FutureImpl}} in Java. {{Future}} class is something 
that provides public API (read access) and holds shared pointer to 
implementation, thus preventing its destruction. The {{Promise}} class here is 
something for which you do not have analogue in managed programming languages. 
Basically, it's guard-class, which holds shared pointer to implementation just 
as {{Future}} but provides write access to it. Its main role is to guarantee 
that that threads waiting on {{Future}} gets released if something goes wrong - 
upon destruction it checks state of the {{SharedState}} class and if it is not 
marked as a completed yet it sets it to error state thus releasing all waiting 
threads.

As for naming - I used one which is commonly used in C++ community. 
(http://www.cplusplus.com/reference/future/future, 
http://www.cplusplus.com/reference/future/promise).

bq. Where does this come from? Windows XP is no longer supported even by 
Microsoft.
https://apacheignite.readme.io/docs/getting-started#section-prerequisites


> 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)

Reply via email to