Skip to content

Commit

Permalink
anticipates the creation of the new handle before locking the necessa…
Browse files Browse the repository at this point in the history
…ry handles
  • Loading branch information
AndreaGuarracino committed Nov 24, 2020
1 parent 7badcd8 commit 4fb7e1e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/odgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,14 @@ void graph_t::apply_ordering(const std::vector<handle_t>& order_in, bool compact
int64_t prec_xxx_handle_num = - 1;

do {
handle_t old_handle = as_handle(as_integers(step)[0]);
handle_t old_handle = as_handle(as_integers(step)[0]);
uint64_t xxx_handle_num = number_bool_packing::unpack_number(old_handle) - min_handle_rank;

handle_t new_handle = ordered.get_handle(
ids[xxx_handle_num],
number_bool_packing::unpack_bit(old_handle)
);

// Lock the current step and the previous one (if present or different from the current one)
do {
{
Expand All @@ -851,14 +856,7 @@ void graph_t::apply_ordering(const std::vector<handle_t>& order_in, bool compact
std::this_thread::sleep_for(std::chrono::nanoseconds(1));
} while (true);

ordered.append_step(
new_path,
// new_handle
ordered.get_handle(
ids[xxx_handle_num],
number_bool_packing::unpack_bit(old_handle)
)
);
ordered.append_step(new_path, new_handle);

if (prec_xxx_handle_num >= 0){
node_unavailable.reset(prec_xxx_handle_num);
Expand Down

0 comments on commit 4fb7e1e

Please sign in to comment.