USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
UHD and USRP Manual
thread.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010,2017 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <cstdint>
12 #include <string>
13 #include <thread>
14 #include <vector>
15 
16 // Forward declaration for set_thread_name(), remove this when deprecated
17 // boost::thread APIs are fully removed.
18 namespace boost {
19 class thread;
20 }
21 
22 namespace uhd {
23 
24 constexpr float DEFAULT_THREAD_PRIORITY = float(0.5);
25 
43  float priority = DEFAULT_THREAD_PRIORITY, bool realtime = true);
44 
51  float priority = DEFAULT_THREAD_PRIORITY, bool realtime = true);
52 
59 [[deprecated("This function will be removed in future versions of UHD, and does "
60  "nothing!")]] UHD_API_HEADER void inline set_thread_name(boost::thread*,
61  const std::string&)
62 {
63  // nop
64 }
65 
71 UHD_API void set_thread_name(std::thread* thread, const std::string& name);
72 
77 UHD_API void set_thread_affinity(const std::vector<size_t>& cpu_affinity_list);
78 
79 } // namespace uhd
#define UHD_API_HEADER
Definition: config.h:88
#define UHD_API
Definition: config.h:87
Definition: thread.hpp:18
Definition: build_info.hpp:12
UHD_API bool set_thread_priority_safe(float priority=DEFAULT_THREAD_PRIORITY, bool realtime=true)
UHD_API_HEADER void set_thread_name(boost::thread *, const std::string &)
Definition: thread.hpp:60
UHD_API void set_thread_priority(float priority=DEFAULT_THREAD_PRIORITY, bool realtime=true)
UHD_API void set_thread_affinity(const std::vector< size_t > &cpu_affinity_list)
constexpr float DEFAULT_THREAD_PRIORITY
Definition: thread.hpp:24