- int sk_wait_data(struct sock * sk, long * timeo);
- sock to wait on
- for how long
Now socket state including sk->sk_err is changed only under lock, hence we may omit checks after joining wait queue. We check receive queue before schedule only as optimization; it is very likely that release_sock added new data.