Skip to content

Commit fe82735

Browse files
Case Beamanfacebook-github-bot
authored andcommitted
Add experiment for preventing thread priority reset if the initial raise did not succeed
Summary: Currently, we will attempt to reset the thread priority no matter what if the thread priority raising was attempted If the attempt to raise failed, there is no need to go through the process of reseting the thread priority --- This is written up in a way that should only expose users into the experiment that fail to raise the thread priority Reviewed By: wesleyer Differential Revision: D75983483 fbshipit-source-id: eeb98b2b3ffaf8bf5ad1f013e69d27f53d6edc19
1 parent 7ce7d4e commit fe82735

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

litho-core/src/main/java/com/facebook/litho/TreeFuture.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ abstract class TreeFuture<T : PotentiallyPartialResult>(
300300
val threadPriorityPair = tryRaiseThreadPriority(runningThreadId, desiredPriority)
301301
originalThreadPriority = threadPriorityPair.first
302302
raisedThreadPriority = threadPriorityPair.second
303-
didRaiseThreadPriority = true
303+
didRaiseThreadPriority =
304+
originalThreadPriority != raisedThreadPriority ||
305+
!ComponentsConfiguration.enablePreventPriorityResetOnRaiseFailure
304306
} else {
305307
originalThreadPriority = Process.THREAD_PRIORITY_DEFAULT
306308
raisedThreadPriority = Process.THREAD_PRIORITY_DEFAULT

litho-core/src/main/java/com/facebook/litho/config/ComponentsConfiguration.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ internal constructor(
289289
*/
290290
@JvmField var enableRaisePriorityToMain: Boolean = false
291291

292+
/**
293+
* This flag will prevent attempting to reset thread priority when the original priority raising
294+
* failed to succeed.
295+
*/
296+
@JvmField var enablePreventPriorityResetOnRaiseFailure: Boolean = false
297+
292298
/** This config will enable logging of interactable components with 0 alpha */
293299
@JvmField var isZeroAlphaLoggingEnabled: Boolean = false
294300

0 commit comments

Comments
 (0)