When Android kills an app, can a function be stopped halfway?

后端 未结 7 2126
青春惊慌失措
青春惊慌失措 2020-12-10 03:30

I am wondering: when an app is to be killed, does Android wait for the currently running function to return, or does Android stop it before it ends by itself?

7条回答
  •  醉酒成梦
    2020-12-10 04:18

    The OS kills the JVM process, with all the "functions" in all the threads. In practical terms, you shouldn't assume that a method is a transaction. Instead, one should assume it can be terminated at any time and design appropriately.

提交回复
热议问题