Skip to content

make uthread internal function override cross platform#465

Merged
ChuanqiXu9 merged 2 commits intoalibaba:mainfrom
c8ef:weak
Mar 25, 2026
Merged

make uthread internal function override cross platform#465
ChuanqiXu9 merged 2 commits intoalibaba:mainfrom
c8ef:weak

Conversation

@c8ef
Copy link
Copy Markdown
Collaborator

@c8ef c8ef commented Mar 24, 2026

Why

__attribute__((weak)) is not supported by MSVC.

What is changing

Replaces weak symbol overriding with a function pointer setter, using the construct-on-first-use idiom to avoid static initialization order issues.

Not sure if going through a function pointer hurts inlining in practice - didn't see any performance regression in the uthread benchmarks though.

Also not sure if depending on the internal api is the right call here, happy to hear thoughts on that.

Example

@c8ef c8ef marked this pull request as ready for review March 24, 2026 13:14
@c8ef c8ef requested review from ChuanqiXu9 and poor-circle March 24, 2026 13:21
Copy link
Copy Markdown
Collaborator

@ChuanqiXu9 ChuanqiXu9 left a comment

Choose a reason for hiding this comment

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

LGTM

@ChuanqiXu9 ChuanqiXu9 merged commit 7aa71d3 into alibaba:main Mar 25, 2026
16 checks passed
@c8ef c8ef deleted the weak branch March 25, 2026 04:15
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