pnoltes commented on code in PR #418:
URL: https://github.com/apache/celix/pull/418#discussion_r877265016


##########
libs/pushstreams/api/celix/AsynchronousPushEventSource.h:
##########
@@ -51,19 +57,14 @@ namespace celix {
 
*********************************************************************************/
 
 template <typename T>
-celix::SimplePushEventSource<T>::SimplePushEventSource(PromiseFactory& 
promiseFactory): AbstractPushEventSource<T>{promiseFactory},
-    executor{promiseFactory.getExecutor()} {
+celix::AsynchronousPushEventSource<T>::AsynchronousPushEventSource(std::shared_ptr<PromiseFactory>&
 promiseFactory): AbstractPushEventSource<T>{promiseFactory},
+                                                                               
                     executor{promiseFactory->getExecutor()} {
 
-//    executor->execute([]() {
-//        for(;;) {
-//
-//        }
-//    });
 }
 
 template <typename T>
-void celix::SimplePushEventSource<T>::execute(std::function<void()> task) {
-    task();
+void celix::AsynchronousPushEventSource<T>::execute(std::function<void()> 
task) {
+    executor->execute(task);

Review Comment:
   Replace with `executor->execute(std::move(task));`



##########
libs/pushstreams/api/celix/impl/AbstractPushEventSource.h:
##########
@@ -102,15 +102,15 @@ void 
celix::AbstractPushEventSource<T>::open(std::shared_ptr<celix::IPushEventCo
 
 template <typename T>
 [[nodiscard]] celix::Promise<void> 
celix::AbstractPushEventSource<T>::connectPromise() {
-    std::lock_guard lck{mutex};
+    std::unique_lock lck{mutex};

Review Comment:
   why unique_lock? IMO lock_guard is preferred If no condition_variable is 
used (call to wait) in the function/scope. 
   So in this case only on line 159 is unique_lock needed, the rest van be kept 
a lock_guard



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

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

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

Reply via email to