|
|
@ -146,18 +146,17 @@ bool threads_new_rt_cpu(pthread_t* thread, void* (*start_routine)(void*), void*
|
|
|
|
int err = pthread_create(thread, attr_enable ? &attr : NULL, start_routine, arg);
|
|
|
|
int err = pthread_create(thread, attr_enable ? &attr : NULL, start_routine, arg);
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
if (EPERM == err) {
|
|
|
|
if (EPERM == err) {
|
|
|
|
// Join failed thread for avoiding memory leak from previous trial
|
|
|
|
fprintf(stderr,
|
|
|
|
pthread_join(*thread, NULL);
|
|
|
|
"Warning: Failed to create thread with real-time priority. Creating it with normal priority: %s\n",
|
|
|
|
|
|
|
|
strerror(err));
|
|
|
|
perror("Warning: Failed to create thread with real-time priority. Creating it with normal priority");
|
|
|
|
|
|
|
|
err = pthread_create(thread, NULL, start_routine, arg);
|
|
|
|
err = pthread_create(thread, NULL, start_routine, arg);
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
perror("pthread_create");
|
|
|
|
fprintf(stderr, "Error: Failed to create thread with normal priority: %s\n", strerror(err));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = true;
|
|
|
|
ret = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
perror("pthread_create");
|
|
|
|
fprintf(stderr, "Error: Failed to create thread with real-time priority: %s\n", strerror(err));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ret = true;
|
|
|
|
ret = true;
|
|
|
|