Skip to content

Commit c85a864

Browse files
Your NameMiguelCompany
authored andcommitted
Refs #23339. Fix threading_pthread.ipp
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent 4590adb commit c85a864

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/cpp/utils/threading/threading_pthread.ipp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
#include <pthread.h>
2121
#include <sys/resource.h>
22+
#if !defined(__QNX__)
2223
#include <sys/sysinfo.h>
24+
#endif //!defined(__QNX__)
2325
#include <sys/time.h>
2426
#include <sys/types.h>
2527

@@ -96,9 +98,12 @@ static void configure_current_thread_scheduler(
9698
// Set Scheduler Class and Priority
9799
//
98100

99-
if ((sched_class == SCHED_OTHER) ||
100-
(sched_class == SCHED_BATCH) ||
101-
(sched_class == SCHED_IDLE))
101+
if ((sched_class == SCHED_OTHER)
102+
#if !defined(__QNX__)
103+
|| (sched_class == SCHED_BATCH)
104+
|| (sched_class == SCHED_IDLE)
105+
#endif // !defined(__QNX__)
106+
)
102107
{
103108
//
104109
// BATCH and IDLE do not have explicit priority values.
@@ -146,6 +151,12 @@ static void configure_current_thread_affinity(
146151
const char* thread_name,
147152
uint64_t affinity_mask)
148153
{
154+
#if defined(__QNX__)
155+
if (affinity_mask > 0)
156+
{
157+
THREAD_EPROSIMA_LOG_ERROR(thread_name, "Setting thread affinity not supported on QNX");
158+
}
159+
#else
149160
int a;
150161
int result;
151162
int cpu_count;
@@ -196,6 +207,7 @@ static void configure_current_thread_affinity(
196207
THREAD_EPROSIMA_LOG_ERROR(thread_name, "Problem to set affinity of thread with id [" << self_tid << "," << thread_name << "] to value " << affinity_mask << ". Error '" << strerror(
197208
result) << "'");
198209
}
210+
#endif // defined(__QNX__)
199211
}
200212

201213
void apply_thread_settings_to_current_thread(

0 commit comments

Comments
 (0)