Copilot commented on code in PR #3039: URL: https://github.com/apache/brpc/pull/3039#discussion_r2232789766
########## src/bthread/task_tracer.cpp: ########## @@ -403,6 +404,10 @@ TaskTracer::Result TaskTracer::SignalTrace(pid_t tid) { // // Therefore, use async-signal-safe absl::DefaultStackUnwinder instead of libunwind. + if (worker_tid == pthread_self()) { + return Result::MakeErrorResult("Forbid to trace self=%d", worker_tid); Review Comment: The format specifier `%d` is incorrect for `pthread_t`. `pthread_t` is an opaque type that may not be an integer on all platforms. Consider using `%p` to format it as a pointer or convert it appropriately for display. ```suggestion return Result::MakeErrorResult("Forbid to trace self=%p", (void*)worker_tid); ``` ########## src/bthread/task_tracer.cpp: ########## @@ -424,11 +429,11 @@ TaskTracer::Result TaskTracer::SignalTrace(pid_t tid) { sigval value{}; value.sival_ptr = signal_sync.get(); size_t sigqueue_try = 0; - while (sigqueue(tid, SIGURG, value) != 0) { + while (pthread_sigqueue(worker_tid, SIGURG, value) != 0) { if (errno != EAGAIN || sigqueue_try++ >= 3) { // Remove reference for SignalHandler. signal_sync->RemoveRefManually(); - return Result::MakeErrorResult("Fail to sigqueue: %s, tid: %d", berror(), tid); + return Result::MakeErrorResult("Fail to pthread_sigqueue: %s, tid: %d", berror(), worker_tid); Review Comment: The format specifier `%d` is incorrect for `pthread_t`. `pthread_t` is an opaque type that may not be an integer on all platforms. Consider using `%p` to format it as a pointer or convert it appropriately for display. ```suggestion return Result::MakeErrorResult("Fail to pthread_sigqueue: %s, tid: %p", berror(), (void*)worker_tid); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org