apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

Support semaphore and rwlock for bthread #2752

Closed chenBright closed 1 month ago

chenBright commented 2 months ago

What problem does this PR solve?

Issue Number:

Problem Summary:

What is changed and the side effects?

Changed:

  1. 按照golang读写锁原理,在bRPC实现了对应的读写锁。
  2. 支持bthread信号量,用于满足读写锁的实现需求,同时开放给用户使用。
  3. contention profiler支持bthread信号量和读写锁。

Side effects:


Check List:

ketor commented 2 months ago

请问这个PR什么时候可以合入呢? 对rwlock有需求,之前提个PR被反馈性能不好,希望尽快用上官方的实现

chenBright commented 2 months ago

请问这个PR什么时候可以合入呢? 对rwlock有需求,之前提个PR被反馈性能不好,希望尽快用上官方的实现

没那么快。读写锁的核心功能已经实现了,还有一些需要优化的地方。

chenBright commented 2 months ago

@wwbmmm 再看看。整理了一下commit,分成三部分,review起来清晰一点。

wwbmmm commented 2 months ago

LGTM

chenBright commented 1 month ago

请问这个PR什么时候可以合入呢? 对rwlock有需求,之前提个PR被反馈性能不好,希望尽快用上官方的实现

@ketor 读写锁的PR已经合入了。之前用#2748 的UT对比了一下两个实现的性能,本PR的性能比#2748 要好一些。