File indexing completed on 2025-01-18 10:00:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "gloo/algorithm.h"
0012 #include "gloo/context.h"
0013 #include "gloo/transport/unbound_buffer.h"
0014
0015 namespace gloo {
0016
0017 class Barrier : public Algorithm {
0018 public:
0019 explicit Barrier(const std::shared_ptr<Context>& context)
0020 : Algorithm(context) {}
0021
0022 virtual ~Barrier(){};
0023 };
0024
0025 class BarrierOptions {
0026 public:
0027 explicit BarrierOptions(const std::shared_ptr<Context>& context);
0028
0029 void setTag(uint32_t tag) {
0030 this->tag = tag;
0031 }
0032
0033 void setTimeout(std::chrono::milliseconds timeout) {
0034 this->timeout = timeout;
0035 }
0036
0037 protected:
0038 std::shared_ptr<Context> context;
0039 std::unique_ptr<transport::UnboundBuffer> buffer;
0040
0041
0042
0043 uint32_t tag = 0;
0044
0045
0046 std::chrono::milliseconds timeout;
0047
0048 friend void barrier(BarrierOptions&);
0049 };
0050
0051 void barrier(BarrierOptions& opts);
0052
0053 }