FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

second refactor of pr-784 with all tests passed · taskflow/taskflow@d7fa4c0 · GitHub

Repository navigation

Commit d7fa4c0

Browse files
Tsung-Wei Huang
committed
second refactor of pr-784 with all tests passed
1 parent f4f8dc2 commit d7fa4c0

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎taskflow/core/error.hpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ struct NSTATE {
2222
constexpr static underlying_type JOINED_SUBFLOW = 0x80000000;
2323

2424
// priority encoding (2 bits): 00=UNSET, 01=HIGH, 10=NORMAL, 11=LOW
25-
constexpr static underlying_type PRIORITY_SHIFT = 26;
26-
constexpr static underlying_type PRIORITY_MASK = 0x0C000000;
25+
constexpr static underlying_type PRIORITY_SHIFT = 26;
26+
constexpr static underlying_type PRIORITY_MASK = 0x0C000000;
2727

2828
// mask to isolate state bits - non-state bits store # strong dependents
2929
constexpr static underlying_type STRONG_DEPENDENCIES_MASK = 0x03FFFFFF;
30+
31+
// mask to clear the state while preserving important bits
32+
constexpr static underlying_type CLEAR_MASK = PRIORITY_MASK;
3033
};
3134

3235
using nstate_t = NSTATE::underlying_type;

‎taskflow/core/executor.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ inline size_t Executor::_set_up_graph(Graph& graph, Topology* tpg, NodeBase* par
24422442
auto node = *first;
24432443
node->_topology = tpg;
24442444
node->_parent = parent;
2445-
node->_nstate &= NSTATE::PRIORITY_MASK;
2445+
node->_nstate &= NSTATE::CLEAR_MASK;
24462446
node->_estate.store(ESTATE::NONE, std::memory_order_relaxed);
24472447
node->_set_up_join_counter();
24482448
node->_exception_ptr = nullptr;

‎taskflow/core/graph.hpp‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,8 @@ class NodeBase {
287287
_join_counter {join_counter} {
288288
}
289289

290-
// encode TaskPriority (HIGH=0,NORMAL=1,LOW=2) as +1 into bits 26-27 of _nstate,
291-
// reserving 00 for UNSET (no priority explicitly assigned)
292290
void _set_priority(TaskPriority p) {
293-
nstate_t encoded = (static_cast<nstate_t>(p) + 1) << NSTATE::PRIORITY_SHIFT;
291+
nstate_t encoded = (static_cast<nstate_t>(p)) << NSTATE::PRIORITY_SHIFT;
294292
_nstate = (_nstate & ~NSTATE::PRIORITY_MASK) | encoded;
295293
}
296294

‎taskflow/core/wsq.hpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <array>
43
#include <bit>
54

65
#include "../utility/macros.hpp"
@@ -929,7 +928,7 @@ concept BoundedWSQLike = requires(Q& q, typename Q::value_type v) {
929928
/**
930929
@brief default priority function for BoundedPriorityWSQ
931930
932-
Calls @c item->_priority_queue() on the element and returns the result as
931+
Calls `T::priority()` on the element and returns the result as
933932
a @c size_t. Users may supply a custom priority function in place of this
934933
default to decouple the queue from any particular element interface.
935934
*/

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL