L 5.5   Blocking send code: pending

(Revision 0 - 12 October 2000)

 

Overview
called from k__ipc (prologue l16,20) and also from ipc_long if message can't be delivered now - receiver not ready
blocks/aborts sender in this case

on entry        v1 sender or virtual sender id

0,2 if infinite timeout goto 7
1,3,4 if >0 timeout got 7
4-6 if 0 timeout, return - message couldn't be delivered now
7-9 abort if trying to send to yourself directly or indirectly
10-16 store thread's state: pending send (infinite timeout) or pending send + in wakeup Q (finite timeout) in TCB and if finite timeout - put thread in kernel's wakeup Q
17 insert this thread's TCB into receiver's Q of pending senders - the list of senders that receiver has not yet received from (called its sendq)
18-38 stack and save sender's state
Note: sp is stored in stcb at l0 of thread_switch_fast macro
39,40 switch t another thread

to_next thread (l5.8 p57 l4)
    1. calls thread_switch_fast to switch memory and stack (thread) contexts including setting new sp
    2. then jumps to address stored on top of new thread's stack