29 lines
664 B
C++
29 lines
664 B
C++
|
|
/// @file dpf/net/mesh_rendezvous.hpp
|
||
|
|
/// @brief Shared in-process port table for party clique joins.
|
||
|
|
#ifndef LIBDPF_INCLUDE_DPF_NET_MESH_RENDEZVOUS_HPP__
|
||
|
|
#define LIBDPF_INCLUDE_DPF_NET_MESH_RENDEZVOUS_HPP__
|
||
|
|
|
||
|
|
#include <atomic>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
namespace dpf
|
||
|
|
{
|
||
|
|
namespace net
|
||
|
|
{
|
||
|
|
|
||
|
|
/// @brief Shared port table: `ports[i]` is party `i`'s listen port (0 until bound).
|
||
|
|
using mesh_ports = std::vector<std::atomic<unsigned short>>;
|
||
|
|
|
||
|
|
inline mesh_ports make_mesh_ports(unsigned n)
|
||
|
|
{
|
||
|
|
mesh_ports ports(n);
|
||
|
|
for (auto & p : ports)
|
||
|
|
p.store(0);
|
||
|
|
return ports;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace net
|
||
|
|
} // namespace dpf
|
||
|
|
|
||
|
|
#endif // LIBDPF_INCLUDE_DPF_NET_MESH_RENDEZVOUS_HPP__
|