You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2023/01/18 12:26:06 UTC

[GitHub] [brpc] jenrryyou commented on a diff in pull request #2086: Fix butex wait_pthread handle EINTR

jenrryyou commented on code in PR #2086:
URL: https://github.com/apache/brpc/pull/2086#discussion_r1073469170


##########
src/bthread/butex.cpp:
##########
@@ -137,7 +137,21 @@ static void wakeup_pthread(ButexPthreadWaiter* pw) {
 
 bool erase_from_butex(ButexWaiter*, bool, WaiterState);
 
-int wait_pthread(ButexPthreadWaiter& pw, timespec* ptimeout) {
+int wait_pthread(ButexPthreadWaiter& pw, const timespec* abstime) {
+    timespec * ptimeout = NULL;
+    timespec timeout;
+    int64_t timeout_us;
+
+    if (abstime != NULL) {
+        timeout_us = butil::timespec_to_microseconds(*abstime) - butil::gettimeofday_us();
+        if (timeout_us < MIN_SLEEP_US) {
+            errno = ETIMEDOUT;
+            return -1;

Review Comment:
   已经修改,感谢指出



-- 
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-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org