Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,10 @@ - (void)_start
*/
NSArray<NSString *> *modulesRequiringMainQueueSetup = [_delegate unstableModulesRequiringMainQueueSetup];

std::shared_ptr<std::mutex> mutex = std::make_shared<std::mutex>();
std::shared_ptr<std::condition_variable> cv = std::make_shared<std::condition_variable>();
std::shared_ptr<bool> isReady = std::make_shared<bool>(false);
dispatch_semaphore_t moduleSetupComplete = dispatch_semaphore_create(0);

_waitUntilModuleSetupComplete = ^{
std::unique_lock<std::mutex> lock(*mutex);
cv->wait(lock, [isReady] { return *isReady; });
dispatch_semaphore_wait(moduleSetupComplete, DISPATCH_TIME_FOREVER);
};

// TODO(T218039767): Integrate perf logging into main queue module init
Expand All @@ -398,9 +395,7 @@ - (void)_start
RCTScreenScale();
RCTSwitchSize();

std::lock_guard<std::mutex> lock(*mutex);
*isReady = true;
cv->notify_all();
dispatch_semaphore_signal(moduleSetupComplete);
});
}

Expand Down
Loading