chenBright commented on code in PR #3545:
URL: https://github.com/apache/brpc/pull/3545#discussion_r4089448041
##########
src/bthread/butex.cpp:
##########
@@ -731,7 +731,13 @@ static int butex_wait_from_pthread(TaskGroup* g, Butex* b,
int expected_value,
30/*nops before sched_yield*/);
if (task->interrupted) {
task->interrupted = false;
- if (rc == 0) {
+ // If interrupted after enqueueing but before futex_wait_private,
+ // pw.sig is already signalled and futex_wait_private may report
+ // EWOULDBLOCK. This is an interruption, not a value mismatch on
+ // the user's butex. Preserve other errors (notably ETIMEDOUT).
+ if (rc == 0 || (errno == EWOULDBLOCK &&
+ pw.sig.load(butil::memory_order_acquire) ==
+ PTHREAD_SIGNALLED)) {
Review Comment:
Fixed in 8c404350748c5134787c813c26c8bf44e4b8733f .
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]