Skip to content

Use dispatch_semaphore for eager-main-queue module setup gate#56932

Open
javache wants to merge 1 commit into
facebook:mainfrom
javache:export-D105953979
Open

Use dispatch_semaphore for eager-main-queue module setup gate#56932
javache wants to merge 1 commit into
facebook:mainfrom
javache:export-D105953979

Conversation

@javache
Copy link
Copy Markdown
Member

@javache javache commented May 22, 2026

Summary:
Replace the std::mutex + std::condition_variable + std::shared_ptr<bool>
trio that gates the JS thread on main-queue module construction with a single
dispatch_semaphore_t. The wait block is invoked exactly once (from
_loadScriptFromSource:'s beforeLoad lambda), so single-shot semaphore
semantics fit the contract directly — no condition predicate, no shared state
captured by three independent shared_ptrs.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D105953979

Summary:
Replace the `std::mutex` + `std::condition_variable` + `std::shared_ptr<bool>`
trio that gates the JS thread on main-queue module construction with a single
`dispatch_semaphore_t`. The wait block is invoked exactly once (from
`_loadScriptFromSource:`'s `beforeLoad` lambda), so single-shot semaphore
semantics fit the contract directly — no condition predicate, no shared state
captured by three independent `shared_ptr`s.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D105953979
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 22, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 22, 2026

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105953979.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant