Skip to content

bthread: convert ADD/SUB_TLS_PTHREAD_LOCK_COUNT macros to inline function#3394

Merged
yanglimingcn merged 1 commit into
apache:masterfrom
altman08:dev
Jul 18, 2026
Merged

bthread: convert ADD/SUB_TLS_PTHREAD_LOCK_COUNT macros to inline function#3394
yanglimingcn merged 1 commit into
apache:masterfrom
altman08:dev

Conversation

@altman08

Copy link
Copy Markdown
Contributor

…tions

Replace the function-like macros ADD_TLS_PTHREAD_LOCK_COUNT and SUB_TLS_PTHREAD_LOCK_COUNT with inline functions
AddTlsPthreadLockCount() and SubTlsPthreadLockCount() (with matching no-op definitions in the BRPC_DEBUG_BTHREAD_SCHE_SAFETY=0 branch). Macros lack type safety and scoping, so encapsulating the logic in regular functions is clearer and safer while keeping the same behavior. All call sites are updated accordingly.

What problem does this PR solve?

Issue Number: resolve

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

…tions

Replace the function-like macros ADD_TLS_PTHREAD_LOCK_COUNT and
SUB_TLS_PTHREAD_LOCK_COUNT with inline functions
AddTlsPthreadLockCount() and SubTlsPthreadLockCount() (with matching
no-op definitions in the BRPC_DEBUG_BTHREAD_SCHE_SAFETY=0 branch).
Macros lack type safety and scoping, so encapsulating the logic in
regular functions is clearer and safer while keeping the same
behavior. All call sites are updated accordingly.
@yanglimingcn

Copy link
Copy Markdown
Contributor

LGTM

@yanglimingcn
yanglimingcn merged commit 92a0aba into apache:master Jul 18, 2026
15 checks passed
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