总体流程:
A发送bc_transaction驱动程序会转换为BR_transaction。
问题1、发给谁?
问题2、回复给谁?
有两个问题
1、发给谁:
test_server中可能有多个线程,binder_proc进程中有todo链表, 进程的thread中也有多个链表。
数据一般放在bind_proc的todo链表中,线程中哪个空闲哪个来执行(唤醒等待于binder_proc,wait的空闲进程)。
proc中有todo链表与wait
对于双向传输,则放放在binder_thread.todo里,如何判断是否为双向传输通过 binder_transaction判断
一开始没有数据,那就放至proc的链表中。
再把数据放至target_list链表,该链表就是server的链表与wait链表。
2、回复给谁:
由于无handle表明目的进程,必定在某个地方有记录发送者。存放在此transaction_stack
发送出去还想得到回复,放至传输栈中。
这里from_parent在发送者的栈中
t表示当前的传输,发给谁、来自于哪里。
test.client其中有一个transaction_stack结构体,用来表示传输栈用来指向一个传输结构 ,其中fram_parent为NULL。
从test_server的binder_proc中的todo链表中取出数据。
t为target将transaction_stack放到target中。
to_parent在接收者的栈中
testServer出栈
testClient出栈
binder_pop_transaction(target_thread, in_reply_to);
target_thread->transaction_stack =
target_thread->transaction_stack->from_parent;
回复给谁