Skip to content

Ubshm transport fix 2 - #58

Open
Sherlock0203 wants to merge 4 commits into
LinQuickDev:masterfrom
Sherlock0203:ubshm_transport_fix_2
Open

Sherlock0203 wants to merge 4 commits into
LinQuickDev:masterfrom
Sherlock0203:ubshm_transport_fix_2

Conversation

@Sherlock0203

Copy link
Copy Markdown

No description provided.

Sherlock0203 and others added 4 commits August 31, 2026 10:42
Make the whole ubring shared-memory module follow the current brpc
conventions, addressing review feedback:

- Replace the module-local LIKELY/UNLIKELY aliases with BAIDU_LIKELY/
  BAIDU_UNLIKELY and drop the aliases from common.h.
- Use BAIDU_SCOPED_LOCK instead of the local GNU cleanup-attribute
  LOCK_GUARD. The pthread_mutex_t members keep their type, allocation
  and lifetime, so no static-init or placement-new change is needed.
- Use butil::atomic instead of std::atomic. The timer handle slots and
  the trx cleanup slot are now real butil::atomic objects, so plain
  storage is never reinterpreted as an atomic: the timer API takes
  butil::atomic<UbrTimerId>* and UbrTrx/UbrCleanupCtl hold atomic
  handles. UbrTrx slots are value-initialized with placement new so
  those atomics are constructed, replacing the per-acquisition memset.
- Drop the two per-node INFO logs on the shm cleanup retry path in
  UbsShmCallback; DeleteShmToList still records each drained node.

No behavioral change: the removed aliases expanded 1:1, BAIDU_SCOPED_LOCK
locks the same pthread_mutex_t, butil::atomic is layout-identical to
std::atomic, and placement-new value-initialization zeroes exactly what
memset zeroed while also constructing the atomic members.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants