uhd/host/lib/rfnoc/device_id.cpp
Martin Braun b92a8e2f2b rfnoc: Add device_id allocator
This is a single atomic allocator in the global uhd::rfnoc namespace, so
that devices can allocate themselves device IDs without having to confer
with the rest of the RFNoC infrastructure.
2019-11-26 11:49:25 -08:00

17 lines
324 B
C++

//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#include <uhdlib/rfnoc/device_id.hpp>
#include <atomic>
using namespace uhd::rfnoc;
device_id_t uhd::rfnoc::allocate_device_id()
{
static std::atomic<device_id_t> counter{1};
return counter++;
}