Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apf/jack_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,19 @@ struct thread_traits; // definition in mimoprocessor.h
template<>
struct thread_traits<jack_policy, pthread_t>
{
static void set_priority(const jack_policy& obj, pthread_t thread_id)
static void update_priority(const jack_policy& obj, pthread_t thread_id) noexcept
{
if (obj.is_realtime())
{
struct sched_param param;
param.sched_priority = obj.get_real_time_priority();
if (pthread_setschedparam(thread_id, SCHED_FIFO, &param))
{
throw std::runtime_error("Can't set scheduling priority for thread!");
// We were trying our best to set the priority, but if it doesn't work,
// the show must go on!
#ifdef APF_JACK_POLICY_DEBUG
printf("Can't set scheduling priority %d for thread!\n", param.sched_priority);
#endif
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions apf/mimoprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace apf
template<typename interface_policy, typename native_handle_type>
struct thread_traits
{
static void set_priority(const interface_policy&, native_handle_type) {}
static void update_priority(const interface_policy&, native_handle_type) noexcept {}
};

class enable_queries
Expand Down Expand Up @@ -371,7 +371,7 @@ class MimoProcessor : public interface_policy
{
// Set thread priority from interface_policy, if available
thread_traits<interface_policy
, std::thread::native_handle_type>::set_priority(parent
, std::thread::native_handle_type>::update_priority(parent
, _thread.native_handle());
}

Expand Down