Skip to content

Commit

Permalink
[audio] Set correct thread pin hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 4, 2023
1 parent 4d869c7 commit 281823c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ossia/audio/alsa_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,12 @@ class alsa_engine final : public audio_engine
}

private:
void init_thread() { ossia::set_thread_name("ossia audio 0"); }
void init_thread()
{
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);
}

void clear_buffers()
{
ossia::fill(this->m_temp_buffer, 0.f);
Expand Down
1 change: 1 addition & 0 deletions src/ossia/audio/dummy_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class dummy_engine final : public audio_engine

m_runThread = std::thread{[this, us_per_buffer] {
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);

using clk = std::chrono::high_resolution_clock;

Expand Down
1 change: 1 addition & 0 deletions src/ossia/audio/jack_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class jack_engine final : public audio_engine
{
static const thread_local auto _ = [] {
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);
return 0;
}();

Expand Down
1 change: 1 addition & 0 deletions src/ossia/audio/pipewire_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ class pipewire_audio_protocol : public audio_engine
{
static const thread_local auto _ = [] {
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);
return 0;
}();

Expand Down
1 change: 1 addition & 0 deletions src/ossia/audio/portaudio_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class portaudio_engine final : public audio_engine
{
static const thread_local auto _ = [] {
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);
return 0;
}();

Expand Down
1 change: 1 addition & 0 deletions src/ossia/audio/sdl_protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class sdl_protocol final : public audio_engine
{
static const thread_local auto _ = [] {
ossia::set_thread_name("ossia audio 0");
ossia::set_thread_pinned(thread_type::Audio, 0);
return 0;
}();

Expand Down

0 comments on commit 281823c

Please sign in to comment.