celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on a change in pull request #272: Feature/cpp17 promise
Date Mon, 20 Jul 2020 20:01:10 GMT

pnoltes commented on a change in pull request #272:
URL: https://github.com/apache/celix/pull/272#discussion_r457653259



##########
File path: misc/experimental/promise/CMakeLists.txt
##########
@@ -52,7 +52,7 @@ if (PROMISE OR PROMISE_STANDALONE)
         $<INSTALL_INTERFACE:include/celix/promise>
     )
     target_link_libraries(Promise INTERFACE TBB::tbb Threads::Threads)
-    target_compile_options(Promise INTERFACE -frtti) #Note needed for TBB
+    target_compile_options(Promise INTERFACE -frtti -std=c++17) #Note needed for TBB

Review comment:
       Te note, is only for -frtti not c++17

##########
File path: misc/experimental/promise/api/celix/Deferred.h
##########
@@ -136,12 +139,81 @@ namespace celix {
          * the specified Promise. The returned Promise will be resolved with a failure of
IllegalStateException if the
          * associated Promise was already resolved when the specified Promise was resolved.
          */
-        //TODO support void promises
-        //Promise<void> resolveWith(Promise<T> with);

Review comment:
       A Promise<void> can be used as way to see if something is done (ok or nok (onResolve
on onFailure). 
   
   The use case for resolving a void promise with a typed promise is (IMO) if you are not
interested in the result downstream, but use want to use the promise as a sync. 
   
   So for example you get Promise<double> from some function (maybe 3rd party) where
the double is the time it took to process, but in "our" API we just want to indicate whether
were a done (success or failed). In this case you can create a Promise<void> and resolve
it with the Promise<double> (regardless if the Promise<double> is already resolved
or not)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message