wwbmmm commented on code in PR #2851:
URL: https://github.com/apache/brpc/pull/2851#discussion_r1893439874


##########
src/butil/reloadable_flags.h:
##########
@@ -0,0 +1,75 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+#ifndef BUTIL_RELOADABLE_FLAGS_H
+#define BUTIL_RELOADABLE_FLAGS_H
+
+#include <stdint.h>
+#include <unistd.h>                    // write, _exit
+#include <gflags/gflags.h>
+#include "butil/macros.h"
+#include "butil/type_traits.h"
+
+// Register an always-true valiator to a gflag so that the gflag is treated as
+// reloadable by brpc. If a validator exists, abort the program.
+// You should call this macro within global scope. for example:
+//
+//   DEFINE_int32(foo, 0, "blah blah");
+//   BRPC_VALIDATE_GFLAG(foo, brpc::PassValidate);
+//
+// This macro does not work for string-flags because they're thread-unsafe to
+// modify directly. To emphasize this, you have to write the validator by
+// yourself and use GFLAGS_NS::GetCommandLineOption() to acess the flag.
+#define BRPC_VALIDATE_GFLAG(flag, validate_fn)                     \

Review Comment:
   名字是不是得改成 BUTIL_VALIDATE_GFLAG



-- 
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

Reply via email to