fausturs
fausturs
**Describe the bug (描述bug)** https://github.com/apache/brpc/blob/master/src/brpc/span.cpp#L133 在代码这个位置,如果是在多个bthread中调用的Span::CreateClientSpan,而他们属于同一个Span的child span。此时他们对brpc::Span::_next_client是存在竞态的。 即便认为这个指针的赋值是原子的,似乎也可能导致内存泄漏。 这里是有什么特殊的设计避免了竞态吗?求解答 **To Reproduce (复现方法)** **Expected behavior (期望行为)** **Versions (各种版本)** OS: Compiler: brpc: protobuf: **Additional context/screenshots (更多上下文/截图)**
I'm using the cmake tool to build my cmake project with bazel. one of my deps is glog/0.5.0 I find rules_foreign_cc copy all .h files of glog to folder EXT_BUILD_DEPS/include....
注意到,目前使用的BUILD.bazel文件中有这样一条宏定义 https://github.com/apache/brpc/blob/master/BUILD.bazel#L25 ``` -D__const__=__unused__ ``` 相关背景可以在issue:https://github.com/apache/brpc/issues/1693 与文档:https://github.com/apache/brpc/blob/master/docs/cn/thread_local.md#gcc4%E4%B8%8B%E7%9A%84errno%E9%97%AE%E9%A2%98 中找到介绍。 总结来说就是 > 务必在直接或间接使用bthread的项目的gcc编译选项中添加-D__const__=__unused__,即把__const__定义为一个无副作用的属性,避免gcc4做相关优化。 对于cmake来说,这个可能不好由brpc仓库进行实现。但对bazel来说,我们有办法由brpc仓库进行这个操作。 具体来说,bazel的cc_library提供一个参数defines, 用于给依赖(或者间接依赖)该目标的目标,添加宏定义。具体的,官方文档为: https://bazel.build/reference/be/c-cpp#cc_library 因此,brpc这边是否考虑,给bthread这个cc_library,直接添加这个宏定义呢