Skip to content

Commit fca3fee

Browse files
committed
.
1 parent 20d3dc4 commit fca3fee

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

opencstl/threading_cc.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -135,33 +135,33 @@ static void cpu_pin(void) {
135135

136136
pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);
137137

138-
// thread_affinity_policy_data_t affinity = {1};
139-
// thread_policy_set(
140-
// mach_thread_self(),
141-
// THREAD_AFFINITY_POLICY,
142-
// (thread_policy_t) & affinity,
143-
// THREAD_AFFINITY_POLICY_COUNT
144-
// );
145-
//
146-
// mach_timebase_info_data_t tb;
147-
// mach_timebase_info(&tb);
148-
//
149-
// #define NS_TO_MACH(ns) ((uint64_t)(ns) * tb.denom / tb.numer)
150-
//
151-
// thread_time_constraint_policy_data_t rt;
152-
// rt.period = 0;
153-
// rt.computation = NS_TO_MACH(500000000);
154-
// rt.constraint = NS_TO_MACH(500000000);
155-
// rt.preemptible = 0;
156-
//
157-
// thread_policy_set(
158-
// mach_thread_self(),
159-
// THREAD_TIME_CONSTRAINT_POLICY,
160-
// (thread_policy_t) & rt,
161-
// THREAD_TIME_CONSTRAINT_POLICY_COUNT
162-
// );
163-
//
164-
// #undef NS_TO_MACH
138+
thread_affinity_policy_data_t affinity = {1};
139+
thread_policy_set(
140+
mach_thread_self(),
141+
THREAD_AFFINITY_POLICY,
142+
(thread_policy_t) & affinity,
143+
THREAD_AFFINITY_POLICY_COUNT
144+
);
145+
146+
mach_timebase_info_data_t tb;
147+
mach_timebase_info(&tb);
148+
149+
#define NS_TO_MACH(ns) ((uint64_t)(ns) * tb.denom / tb.numer)
150+
151+
thread_time_constraint_policy_data_t rt;
152+
rt.period = 0;
153+
rt.computation = NS_TO_MACH(500000000);
154+
rt.constraint = NS_TO_MACH(500000000);
155+
rt.preemptible = 0;
156+
157+
thread_policy_set(
158+
mach_thread_self(),
159+
THREAD_TIME_CONSTRAINT_POLICY,
160+
(thread_policy_t) & rt,
161+
THREAD_TIME_CONSTRAINT_POLICY_COUNT
162+
);
163+
164+
#undef NS_TO_MACH
165165
#endif
166166
}
167167
#endif

0 commit comments

Comments
 (0)