mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Back out "Fix incorrect locking in ShadowTree experiment" (#52679)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52679 Changelog: [internal] Reverting to make the fix easier to pick. Will land again on top. Original commit changeset: c18e967488de Original Phabricator Diff: D78480136 Reviewed By: cortinico Differential Revision: D78497510 fbshipit-source-id: 8037276cb70d27ff695c76cd9575b525568c4489
This commit is contained in:
1 parent
4c9591c0ea
commit
fef6e0f584
2 files changed
+5
-13
No files matched your search
@@ -256,7 +256,7 @@ CommitStatus ShadowTree::commit(
|
||||
|
||||
{
|
||||
std::unique_lock lock(commitMutex_);
|
||||
return tryCommit(transaction, commitOptions, true);
|
||||
return tryCommit(transaction, commitOptions);
|
||||
}
|
||||
} else {
|
||||
while (true) {
|
||||
@@ -276,8 +276,7 @@ CommitStatus ShadowTree::commit(
|
||||
|
||||
CommitStatus ShadowTree::tryCommit(
|
||||
const ShadowTreeCommitTransaction& transaction,
|
||||
const CommitOptions& commitOptions,
|
||||
bool hasLocked) const {
|
||||
const CommitOptions& commitOptions) const {
|
||||
TraceSection s("ShadowTree::commit");
|
||||
|
||||
auto telemetry = TransactionTelemetry{};
|
||||
@@ -289,10 +288,7 @@ CommitStatus ShadowTree::tryCommit(
|
||||
|
||||
{
|
||||
// Reading `currentRevision_` in shared manner.
|
||||
std::shared_lock lock(commitMutex_, std::defer_lock);
|
||||
if (!hasLocked) {
|
||||
lock.lock();
|
||||
}
|
||||
std::shared_lock lock(commitMutex_);
|
||||
commitMode = commitMode_;
|
||||
oldRevision = currentRevision_;
|
||||
}
|
||||
@@ -333,10 +329,7 @@ CommitStatus ShadowTree::tryCommit(
|
||||
|
||||
{
|
||||
// Updating `currentRevision_` in unique manner if it hasn't changed.
|
||||
std::unique_lock lock(commitMutex_, std::defer_lock);
|
||||
if (!hasLocked) {
|
||||
lock.lock();
|
||||
}
|
||||
std::unique_lock lock(commitMutex_);
|
||||
|
||||
if (currentRevision_.number != oldRevision.number) {
|
||||
return CommitStatus::Failed;
|
||||
|
||||
@@ -111,8 +111,7 @@ class ShadowTree final {
|
||||
*/
|
||||
CommitStatus tryCommit(
|
||||
const ShadowTreeCommitTransaction& transaction,
|
||||
const CommitOptions& commitOptions,
|
||||
bool hasLocked = false) const;
|
||||
const CommitOptions& commitOptions) const;
|
||||
|
||||
/*
|
||||
* Calls `tryCommit` in a loop until it finishes successfully.
|
||||
|
||||
Reference in new issue
Block a user