Skip to content

Add TSMutex lock guard#13188

Open
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:tsmutex-lock-guard
Open

Add TSMutex lock guard#13188
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:tsmutex-lock-guard

Conversation

@bneradt
Copy link
Copy Markdown
Contributor

@bneradt bneradt commented May 21, 2026

Plugin code that protects small critical sections with TSMutex has to pair
every early return with a matching unlock. That pattern is easy to get wrong
and makes the intended lock lifetime harder to see.

This adds a small TSMutexLockGuard helper to the plugin API and uses it in
plugin code where the mutex naturally stays locked until a return path.

Copilot AI review requested due to automatic review settings May 21, 2026 19:13
@bneradt bneradt added this to the 11.0.0 milestone May 21, 2026
@bneradt bneradt self-assigned this May 21, 2026
@bneradt bneradt added TS API Plugins Enhancement easy_review No new logic, easy to review. Feedback Needed Request people to provide feedback. labels May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@zwoop zwoop requested review from masaori335 and zwoop May 21, 2026 20:58
zwoop
zwoop previously approved these changes May 21, 2026
Comment thread include/ts/ts.h Outdated
Plugin code that protects small critical sections with TSMutex has to pair
every early return with a matching unlock. That pattern is easy to get wrong
and makes the intended lock lifetime harder to see.

This adds a small TSMutexLockGuard helper to the plugin API and uses it in
plugin code where the mutex naturally stays locked until a return path.
@bneradt bneradt force-pushed the tsmutex-lock-guard branch from 582bc8c to ca811de Compare May 23, 2026 22:20
@bneradt bneradt requested a review from zwoop May 23, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

easy_review No new logic, easy to review. Enhancement Feedback Needed Request people to provide feedback. Plugins TS API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants