OSSIA
Open Scenario System for Interactive Application
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
thread.hpp
1#pragma once
2#include <ossia/detail/config.hpp>
3
4#include <ossia/detail/flat_map.hpp>
5
6#include <string>
7#include <thread>
8
9namespace ossia
10{
11OSSIA_EXPORT
12void set_thread_realtime(std::thread& t, int prio = 99, bool algo_fifo = true);
13OSSIA_EXPORT
14void set_thread_name(std::thread& t, std::string_view name);
15OSSIA_EXPORT
16void set_thread_name(std::string_view name);
17OSSIA_EXPORT
18void set_thread_pinned(int cpu);
19
20enum class thread_type : unsigned char
21{
22 Net = 'N',
23 Midi = 'M',
24 Gpu = 'G',
25 GpuTask = 'g',
26 Audio = 'A',
27 AudioTask = 'a',
28 Ui = 'U',
29 UiTask = 'u'
30};
31
32struct thread_spec
33{
34 int num_threads{};
35 int spin_interval{};
36};
37
38using thread_specs = ossia::flat_map<thread_type, thread_spec>;
39
40OSSIA_EXPORT
41const thread_specs& get_thread_specs() noexcept;
42
43// Schedule e.g. the third net thread on the appropriate CPU
44OSSIA_EXPORT
45void set_thread_pinned(thread_type kind, int thread_index);
46
47OSSIA_EXPORT
48std::string get_exe_path();
49
50OSSIA_EXPORT
51std::string get_module_path();
52
53OSSIA_EXPORT
54int get_pid();
55}
Definition git_info.h:7