Skip to content

Commit 19aefcc

Browse files
Print stderr message if pthread_setname_np() fail
This get rid of this compile time warning: Compiling rtapi/uspace_rtapi_app.cc rtapi/uspace_rtapi_app.cc: In function ‘void {anonymous}::set_namef(const char*, ...)’: rtapi/uspace_rtapi_app.cc:107:9: warning: unused variable ‘res’ [-Wunused-variable] 107 | int res = pthread_setname_np(pthread_self(), buf); | ^~~
1 parent 973ecc3 commit 19aefcc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/rtapi/uspace_rtapi_app.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static void set_namef(const char *fmt, ...) {
105105
va_end(ap);
106106

107107
int res = pthread_setname_np(pthread_self(), buf);
108+
if (res) {
109+
fprintf(stderr, "pthread_setname_np() failed for %s: %d\n", buf, res);
110+
}
108111
free(buf);
109112
}
110113

0 commit comments

Comments
 (0)