On Thu, Aug 23, 2012 at 12:36 PM, Asias He <asias.hejun@xxxxxxxxx> wrote: >>> while (1) { >>> + pos = payload; >>> >>> ret = read(sk->fd, payload, UIP_MAX_TCP_PAYLOAD); >>> >>> if (ret <= 0 || ret > UIP_MAX_TCP_PAYLOAD) >>> goto out; >>> >>> - uip_tcp_payload_send(sk, UIP_TCP_FLAG_ACK, ret); >>> + left = ret; >>> + >>> + while (left > 0) { >>> + while ((len = sk->guest_acked + sk->window_size - sk->seq_server) <= 0) >>> + usleep(100); >> >> So what exactly is this piece of code trying to accomplish? Surely >> there's some more reasonable way to handle it? > > Wait until the guest is available to receive some more tcp data. > > Yes, we can introduce some sync ops here to do this. But for now, I'd > prefer this simple method ;-) It doesn't look all that simple and since there's no locking, it's not safe. Can we use pthread condition variables here? Pekka -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html