androidSource
androidSource copied to clipboard
binder的rpc到底是同步还是异步的?
本文当中说是单向异步的,但是这篇文章里面却说是同步的,求真相
貌似确实是同步的,官方文档:For example, when an IPC is made from process A to process B, the calling thread in A blocks in transact() as it sends the transaction to process B. The next available pool thread in B receives the incoming transaction, calls Binder.onTransact() on the target object, and replies with the result Parcel. Upon receiving its result, the thread in process A returns to allow its execution to continue.
https://developer.android.com/reference/android/os/IBinder.html
支持异步binder,onTransact指定FLAG_ONEWAY,就是异步调用。