FLAG_RECEIVER_FOREGROUND 在发送有序广播时到底做了什么?
What exactly does FLAG_RECEIVER_FOREGROUND do when sending ordered broadcasts?
发送有序广播时,FLAG_RECEIVER_FOREGROUND 究竟做了什么?
它是否真的加快了速度,还是只是告诉接收者你没有时间做你的事情,否则我会生气?
它说:
If set, when sending a broadcast the recipient is allowed to run at
foreground priority, with a shorter timeout interval. During normal
broadcasts the receivers are not automatically hoisted out of the
background priority class.
什么是
with a shorter timeout interval
是什么意思?
这提高了 Thread
的优先级,即 运行 BroadcastReceiver
,这将允许它比较低优先级的竞争线程获得更多的 CPU 周期。如果有很多竞争线程,这可能会加快速度。
发送有序广播时,FLAG_RECEIVER_FOREGROUND 究竟做了什么?
它是否真的加快了速度,还是只是告诉接收者你没有时间做你的事情,否则我会生气?
它说:
If set, when sending a broadcast the recipient is allowed to run at foreground priority, with a shorter timeout interval. During normal broadcasts the receivers are not automatically hoisted out of the background priority class.
什么是
with a shorter timeout interval
是什么意思?
这提高了 Thread
的优先级,即 运行 BroadcastReceiver
,这将允许它比较低优先级的竞争线程获得更多的 CPU 周期。如果有很多竞争线程,这可能会加快速度。