Skip to content

[NativeAOT] Use POSIX primitives for GC bridge processing#12141

Open
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/nativeaot-posix-gc-bridge
Open

[NativeAOT] Use POSIX primitives for GC bridge processing#12141
simonrozsival wants to merge 1 commit into
mainfrom
dev/simonrozsival/nativeaot-posix-gc-bridge

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Summary

Replace the NativeAOT-reachable GC bridge's C++ threading primitives with POSIX primitives.

This removes the std::thread, std::binary_semaphore, and associated libc++ atomic-wait/thread runtime dependency from this subsystem as part of #12139.

Changes

  • replace the detached std::thread worker with pthread_create() / pthread_detach();
  • replace std::binary_semaphore with sem_t;
  • retry sem_wait() after EINTR;
  • preserve acquire/release synchronization for the shared callback argument with compiler atomics;
  • surface pthread/semaphore failures through the existing abort helpers.

The bridge-processing algorithm and callback lifecycle are unchanged.

Validation

  • git diff --check
  • Release build of src/native/native-nativeaot.csproj
  • Release build of src/native/native-clr.csproj
  • focused concurrency review covering initialization, memory ordering, EINTR, and detached worker behavior

Part of #12139.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 187b207a-083b-461e-9071-e9aab61c9d07
Copilot AI review requested due to automatic review settings July 16, 2026 23:21
@simonrozsival simonrozsival added the drop-libcpp Work to remove the libc++ dependency from Android NativeAOT label Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drop-libcpp Work to remove the libc++ dependency from Android NativeAOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants