Skip to content

Commit

Permalink
Launch deferred #21 (#23)
Browse files Browse the repository at this point in the history
* #21 adding std::launch option when adding tasks and a execute_deferred() function to executed tasks queued as deferred

* #21 changed name from evaluate_deferred to invoke_deferred and added minimal test

* 🎨 Committing clang-format changes

* #21 Trying to adjust for failing tests on apple-clang

* #21 increasing test coverage

* #21 Correcting some tests that got locked up

* 🎨 Committing clang-format changes

* #24 corrected race condition

* #21 doesnt like magic numbers

* Corrected timedecrement in tests

* #21

* 🎨 Committing clang-format changes

* 🎨 Committing clang-format changes

* 🎨 Committing clang-format changes

---------

Co-authored-by: Clang Robot <robot@example.com>
  • Loading branch information
benny-edlund and Clang Robot committed Sep 16, 2023
1 parent cfed231 commit 06dc1c2
Show file tree
Hide file tree
Showing 3 changed files with 462 additions and 306 deletions.
9 changes: 7 additions & 2 deletions lib/public/task_pool/pipes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <chrono>
#include <future>
#include <task_pool/fallbacks.h>
#include <task_pool/pool.h>
#include <task_pool/traits.h>
Expand Down Expand Up @@ -28,7 +29,9 @@ TASKPOOL_HIDDEN auto make_pipe( be::task_pool_t< Allocator >& pool, Func&& func,
// are most certainly used in the defined class
//
using future_type = decltype( std::declval< be::task_pool_t< Allocator > >().submit(
std::declval< Func >(), std::forward< Args >( std::declval< Args >() )... ) );
std::launch::async,
std::declval< Func >(),
std::forward< Args >( std::declval< Args >() )... ) );
using value_type = decltype( std::declval< future_type >().get() );
using status_type = decltype( std::declval< future_type >().wait_for(
std::declval< std::chrono::seconds >() ) );
Expand Down Expand Up @@ -72,7 +75,9 @@ TASKPOOL_HIDDEN auto make_pipe( be::task_pool_t< Allocator >& pool, Func&& func,
}
};
return pipe_( pool,
pool.submit( std::forward< Func >( func ), std::forward< Args >( args )... ) );
pool.submit( std::launch::async,
std::forward< Func >( func ),
std::forward< Args >( args )... ) );
}

template< typename TaskPool,
Expand Down

0 comments on commit 06dc1c2

Please sign in to comment.