Skip to content

Commit 095e9fa

Browse files
committed
Merge pull request #176 from meyerj/display_thread_names
Do not abort if pthread_setname_np fails
1 parent 757b718 commit 095e9fa

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

rtt/os/gnulinux/fosi_internal.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,21 @@ namespace RTT
170170
if (thread_name_len > MAX_THREAD_NAME_SIZE) {
171171
thread_name += thread_name_len - MAX_THREAD_NAME_SIZE;
172172
}
173-
rv = pthread_setname_np(task->thread, thread_name);
174-
if (rv != 0) {
173+
int result = pthread_setname_np(task->thread, thread_name);
174+
if (result != 0) {
175175
log(Error) << "Failed to set thread name for " << task->name << ": "
176-
<< strerror(rv) << endlog();
177-
return rv;
176+
<< strerror(result) << endlog();
178177
}
179178
}
180179

181-
if ( cpu_affinity != (unsigned)~0 ) {
182-
log(Debug) << "Setting CPU affinity to " << cpu_affinity << endlog();
183-
if (0 != rtos_task_set_cpu_affinity(task, cpu_affinity))
184-
{
185-
log(Error) << "Failed to set CPU affinity to " << cpu_affinity << endlog();
186-
}
187-
}
180+
if ( cpu_affinity != (unsigned)~0 ) {
181+
log(Debug) << "Setting CPU affinity to " << cpu_affinity << endlog();
182+
int result = rtos_task_set_cpu_affinity(task, cpu_affinity);
183+
if (result != 0) {
184+
log(Error) << "Failed to set CPU affinity to " << cpu_affinity << " for " << task->name << ": "
185+
<< strerror(result) << endlog();
186+
}
187+
}
188188

189189
return rv;
190190
}

0 commit comments

Comments
 (0)