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 2021/01/11 06:46:00 UTC

[GitHub] [incubator-brpc] gydong commented on a change in pull request #1326: bthread/butex: check butex create

gydong commented on a change in pull request #1326:
URL: https://github.com/apache/incubator-brpc/pull/1326#discussion_r554802130



##########
File path: src/bthread/butex.cpp
##########
@@ -241,10 +241,8 @@ inline int unsleep_if_necessary(ButexBthreadWaiter* w,
 
 void* butex_create() {
     Butex* b = butil::get_object<Butex>();
-    if (b) {
-        return &b->value;
-    }
-    return NULL;
+    CHECK(b != nullptr) << "cannot allocate butex";

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.

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