Skip to content

Commit 81c26ca

Browse files
Moved to lazy
1 parent 6f00386 commit 81c26ca

File tree

1 file changed

+3
-13
lines changed
  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge

1 file changed

+3
-13
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.kt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,10 @@
1616
*/
1717
public object UiThreadUtil {
1818

19-
@Volatile private var mainHandlerInternal: Handler? = null
2019

21-
22-
private val mainHandler: Handler
23-
get() {
24-
if (mainHandlerInternal == null) {
25-
synchronized(this) {
26-
if (mainHandlerInternal == null) {
27-
mainHandlerInternal = Handler(Looper.getMainLooper())
28-
}
29-
}
30-
}
31-
return mainHandlerInternal!!
32-
}
20+
private val mainHandler: Handler by lazy {
21+
Handler(Looper.getMainLooper())
22+
}
3323

3424
/**
3525
* Returns the handler associated with the main (UI) thread.

0 commit comments

Comments
 (0)