• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #874

25 Jan 2023 02:55PM UTC coverage: 85.911% (+0.03%) from 85.883%
#874

push

StellarBot
Merge #6153

6153: Assign global ids to managed component instances that are locally resolvable r=hkaiser a=hkaiser

This will reduce contention while resolving global ids.

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

61 of 61 new or added lines in 5 files covered. (100.0%)

173513 of 201968 relevant lines covered (85.91%)

2065249.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.5
/libs/full/components_base/src/generate_unique_ids.cpp
1
//  Copyright (c) 2007-2021 Hartmut Kaiser
2
//  Copyright (c) 2011      Bryce Lelbach
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/config.hpp>
9
#include <hpx/components_base/agas_interface.hpp>
10
#include <hpx/components_base/generate_unique_ids.hpp>
11
#include <hpx/thread_support/unlock_guard.hpp>
12

13
#include <algorithm>
14
#include <cstddef>
15
#include <mutex>
16

17
namespace hpx { namespace util {
18

19
    naming::gid_type unique_id_ranges::get_id(std::size_t count)
1,062✔
20
    {
21
        // create a new id
22
        std::unique_lock l(mtx_);
1,062✔
23

24
        // ensure next_id doesn't overflow
25
        while (!lower_ || (lower_ + count) > upper_)
1,062✔
26
        {
27
            lower_ = naming::invalid_gid;
×
28

29
            naming::gid_type lower;
×
30
            std::size_t count_ = (std::max)(std::size_t(range_delta), count);
×
31

32
            {
33
                hpx::unlock_guard ul(l);
×
34
                lower = hpx::agas::get_next_id(count_);
×
35
            }
×
36

37
            // we ignore the result if some other thread has already set the
38
            // new lower range
39
            if (!lower_)
×
40
            {
41
                lower_ = lower;
×
42
                upper_ = lower + count_;
×
43
            }
×
44
        }
45

46
        naming::gid_type result = lower_;
1,062✔
47
        lower_ += count;
1,062✔
48
        return result;
49
    }
1,062✔
50
}}    // namespace hpx::util
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc