thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bgedik <...@git.apache.org>
Subject [GitHub] thrift pull request #1080: THRIFT-3891 TNonblockingServer configured with mo...
Date Wed, 25 Jan 2017 05:34:10 GMT
Github user bgedik commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1080#discussion_r97712383
  
    --- Diff: lib/cpp/src/thrift/server/TNonblockingServer.cpp ---
    @@ -1524,7 +1532,7 @@ void TNonblockingIOThread::breakLoop(bool error) {
       }
     
       // sets a flag so that the loop exits on the next event
    -  event_base_loopbreak(eventBase_);
    +  event_base_loopexit(eventBase_, 0);
    --- End diff --
    
    There are some subtle differences between the two. The first difference is what you already
mentioned. The second difference is that, event_base_loopbreak will have no effect when there
is no loop running: http://www.wangafu.net/~nickm/libevent-book/Ref3_eventloop.html. In contrast,
event_base_loopexit is not `lost` if it is called without having a loop running.
    
    In the TNonblockingServer code, event_base_loopbreak is called without checking if the
loop started running.
    
    An alternative fix would be to keep the event_base_loopbreak, but somehow introduce additional
synchronization to make sure it is not lost.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message