File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
include/cpputils2/linux/thread Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ namespace CppUtils2
4444 }
4545 };
4646
47+ struct DeadLineThreadConfig : public ThreadConfig
48+ {
49+ DeadLineThreadConfig ()
50+ {
51+ policy = SCHED_DEADLINE;
52+ priority = 0 ;
53+ }
54+ };
55+
4756 Result set_thread_sched_policy (std::thread &thread, const int policy, const int priority)
4857 {
4958 struct sched_param param;
Original file line number Diff line number Diff line change @@ -147,11 +147,18 @@ namespace
147147 TEST (ThreadMng, ThreadMng)
148148 {
149149 CppUtils2::BestEffortThreadConfig config;
150+
150151 std::thread t ([&config]() {
151152
152153 });
153154 auto ret = CppUtils2::set_thread_sched_policy (t, config);
154155 EXPECT_EQ (ret, CppUtils2::Result::RET_OK);
156+
157+ auto exp_config = CppUtils2::get_thread_sched_policy (t);
158+ EXPECT_TRUE (exp_config.has_value ());
159+ EXPECT_EQ (exp_config.value ().policy , config.policy );
160+ EXPECT_EQ (exp_config.value ().priority , config.priority );
161+
155162 t.join ();
156163 }
157164
You can’t perform that action at this time.
0 commit comments