Parcourir la source

process: merge peek/release, no need for two functions

skypjack il y a 9 mois
Parent
commit
9c4676f4c0

+ 0 - 8
src/entt/process/process.hpp

@@ -188,14 +188,6 @@ public:
         next = std::move(child);
         next = std::move(child);
     }
     }
 
 
-    /**
-     * @brief Releases ownership of the child process, if any.
-     * @return The child process attached to the object, if any.
-     */
-    std::shared_ptr<basic_process> release() {
-        return std::move(next);
-    }
-
     /**
     /**
      * @brief Returns the child process without releasing ownership, if any.
      * @brief Returns the child process without releasing ownership, if any.
      * @return The child process attached to the object, if any.
      * @return The child process attached to the object, if any.

+ 1 - 1
src/entt/process/scheduler.hpp

@@ -287,7 +287,7 @@ public:
             auto &elem = handlers.first()[pos];
             auto &elem = handlers.first()[pos];
 
 
             if(elem->finished()) {
             if(elem->finished()) {
-                elem = std::move(elem->release());
+                elem = elem->peek();
             }
             }
 
 
             if(!elem || elem->rejected()) {
             if(!elem || elem->rejected()) {

+ 1 - 5
test/entt/process/process.cpp

@@ -185,7 +185,7 @@ TEST(Process, AbortImmediately) {
     ASSERT_TRUE(process.aborted_invoked);
     ASSERT_TRUE(process.aborted_invoked);
 }
 }
 
 
-TEST(ProcessAdaptor, ThenReleasePeek) {
+TEST(ProcessAdaptor, ThenPeek) {
     test_process<int> process{};
     test_process<int> process{};
 
 
     ASSERT_FALSE(process.peek());
     ASSERT_FALSE(process.peek());
@@ -195,10 +195,6 @@ TEST(ProcessAdaptor, ThenReleasePeek) {
     ASSERT_TRUE(process.peek());
     ASSERT_TRUE(process.peek());
     // peek does not release ownership
     // peek does not release ownership
     ASSERT_TRUE(process.peek());
     ASSERT_TRUE(process.peek());
-
-    auto other = process.release();
-
-    ASSERT_FALSE(process.peek());
 }
 }
 
 
 TEST(ProcessAdaptor, Resolved) {
 TEST(ProcessAdaptor, Resolved) {