Skip to content

Commit

Permalink
[ci] Build fixes due to functions unavailable on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Aug 10, 2023
1 parent 0f43595 commit 27ef2b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ossia/detail/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,19 @@ void set_thread_name(std::string_view name)

void set_thread_pinned(int cpu)
{
cpu_set_t cpus;
#if(BOOST_OS_UNIX || BOOST_OS_LINUX || BOOST_OS_BSD || BOOST_LIB_C_GNU)

#if(BOOST_LIB_C_GNU)
cpu_set_t cpus{};
#else // FreeBSD, NetBSD
cpuset_t cpus{};
#endif

CPU_ZERO(&cpus);
CPU_SET(cpu, &cpus);

pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpus);
pthread_setaffinity_np(pthread_self(), sizeof(cpus), &cpus);
#endif
}

int get_pid()
Expand Down

0 comments on commit 27ef2b7

Please sign in to comment.