Skip to content

Commit

Permalink
Test prioritising REST thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaute Lindkvist committed Nov 8, 2024
1 parent b5d1448 commit a9c2f60
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion RestInterface/cafRestServerApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,19 @@ void RestServerApplication::run()
std::vector<std::thread> v;
v.reserve( m_threads - 1 );
for ( auto i = m_threads - 1; i > 0; --i )
v.emplace_back( [this] { m_ioContext.run(); } );
v.emplace_back(
[this, i]
{
#ifdef __linux__
const sched_param param{ .sched_priority = 10 };
if ( pthread_setschedparam( pthread_self(), SCHED_FIFO, &param ) )
{
CAFFA_WARNING( "Failed to set higher priority for REST thread " << i );
}
#endif

m_ioContext.run();
} );

boost::asio::signal_set signals( m_ioContext, SIGINT, SIGTERM );
signals.async_wait(
Expand Down

0 comments on commit a9c2f60

Please sign in to comment.