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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

0.0
/examples/pipeline/worker.cpp
1
//  Copyright (c) 2018 Thomas Heller
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#if !defined(HPX_COMPUTE_DEVICE_CODE)
9
#include <hpx/hpx.hpp>
10
#include <hpx/hpx_main.hpp>
11

12
#include <iostream>
13

14
HPX_REGISTER_CHANNEL(int, pipeline)
×
15

16
hpx::future<void> f2(hpx::lcos::channel<int>& c1, hpx::lcos::channel<int>& c2)
×
17
{
18
    hpx::future<int> f = c1.get();
19
    return f.then([&c1, &c2](hpx::future<int> f) {
×
20
        try
21
        {
22
            int i = f.get();
×
23
            std::cout << "Second stage: " << i << ". Executed on locality "
×
24
                      << hpx::get_locality_id() << " "
×
25
                      << hpx::get_locality_name() << '\n';
×
26
            c2.set(i + 1);
×
27
            hpx::this_thread::sleep_for(std::chrono::microseconds(10));
×
28
            return f2(c1, c2);
×
29
        }
30
        catch (...)
×
31
        {
32
            c2.close();
×
33
            return hpx::make_ready_future();
34
        }
×
35
    });
×
36
}
37

38
int main()
×
39
{
40
    std::cout << "Starting worker\n";
×
41
    hpx::lcos::channel<int> c1;
×
42
    hpx::lcos::channel<int> c2;
×
43

44
    c1.connect_to("pipeline/emitter");
×
45
    c2.connect_to("pipeline/collector");
×
46

47
    f2(c1, c2).get();
×
48

49
    return 0;
50
}
51
#endif
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

© 2025 Coveralls, Inc