2017-04-22 05:33:16 +00:00
|
|
|
//
|
|
|
|
|
// Copyright 2010-2011 Ettus Research LLC
|
2018-02-19 23:30:32 +00:00
|
|
|
// Copyright 2018 Ettus Research, a National Instruments Company
|
2017-04-22 05:33:16 +00:00
|
|
|
//
|
2018-02-19 23:30:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2017-04-22 05:33:16 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <uhd/utils/tasks.hpp>
|
2019-01-14 18:35:25 +00:00
|
|
|
#include <boost/test/unit_test.hpp>
|
2017-04-22 05:33:16 +00:00
|
|
|
#include <chrono>
|
|
|
|
|
#include <iostream>
|
2019-01-14 18:35:25 +00:00
|
|
|
#include <thread>
|
|
|
|
|
#include <vector>
|
2017-04-22 05:33:16 +00:00
|
|
|
|
|
|
|
|
void test_tasks_sleep(size_t usecs)
|
|
|
|
|
{
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(usecs));
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-14 18:35:25 +00:00
|
|
|
BOOST_AUTO_TEST_CASE(tasks_test)
|
|
|
|
|
{
|
2017-04-22 05:33:16 +00:00
|
|
|
static const size_t N_TASKS = 100;
|
|
|
|
|
std::vector<uhd::task::sptr> test_vec;
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < N_TASKS; i++) {
|
2019-01-14 18:35:25 +00:00
|
|
|
test_vec.push_back(uhd::task::make([i]() { test_tasks_sleep(i); }));
|
2017-04-22 05:33:16 +00:00
|
|
|
}
|
|
|
|
|
}
|