Remove redundant synchronization in NetworkHandlerSupport.setState

This commit is contained in:
Him188 2021-06-17 19:46:29 +08:00
parent eba6706b47
commit 99d232efe8

View File

@ -222,8 +222,8 @@ internal abstract class NetworkHandlerSupport(
*/
protected inline fun <reified S : BaseStateImpl> BaseStateImpl.setState(
noinline new: () -> S
): S? = synchronized(setStateLock) {
if (_state === this) {
): S? {
return if (_state === this) {
this@NetworkHandlerSupport.setState(new)
} else {
null