Skip to content

Commit 773ab11

Browse files
committed
Remove pending_task struct
1 parent fa0d099 commit 773ab11

6 files changed

Lines changed: 9 additions & 19 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ endif()
2525
set(_DISPATCH_QUEUE_HEADERS
2626
"include/dispatch_queue.hpp"
2727
"include/function_result.hpp"
28-
"include/pending_task.hpp"
28+
"include/is_instance_of.hpp"
2929
"include/pending_task_queue.hpp"
30+
"include/promise.hpp"
31+
"include/task_future.hpp"
32+
"include/task.hpp"
3033
"include/worker_pool.hpp"
3134
)
3235

include/pending_task.hpp

Lines changed: 0 additions & 11 deletions
This file was deleted.

include/pending_task_queue.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
#include <deque>
44

5-
#include "pending_task.hpp"
6-
7-
85
namespace dispatch_queue {
96

107
namespace detail {
118

9+
using pending_task = std::function<void()>;
10+
1211
class pending_task_queue {
1312
public:
1413
bool empty() const;

include/worker_pool.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <mutex>
66
#include <thread>
77

8-
#include "pending_task.hpp"
98
#include "pending_task_queue.hpp"
109

1110

src/dispatch_queue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ void dispatch_queue::clear() {
4949
}
5050

5151
void dispatch_queue::main_loop() {
52-
std::deque<pending_task> main_loop_tasks = worker_pool
52+
std::deque<detail::pending_task> main_loop_tasks = worker_pool
5353
? worker_pool->pop_main_loop_tasks()
5454
: task_queue.pop_main_loop_tasks();
5555
for (auto&& it : main_loop_tasks) {
56-
it.work();
56+
it();
5757
}
5858
}
5959

src/worker_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void worker_pool::run_task_loop() {
7474
}
7575

7676
// 2. Do some work
77-
task.work();
77+
task();
7878

7979
// 3. If all is done, notify waiters
8080
bool all_done;

0 commit comments

Comments
 (0)