ploop_copy_send: use while in pthread_cond_wait

It's a common practice and a good thing to recheck
the condition after being woken up.

Reported-by: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
ploop_copy_send: wait for send_thread to finish

This should fix a race condition between the main process and send_thread.

The problem is that the main process doesn't wait for send_thread to
finish its work, incorrectly assuming that if it can take the mutex lock
again, the send_thread has already finished. But there might be a situation
when send_thread() still waits in pthread_cond_wait() (with the mutex
lock released), while async_send goes on to rewrite sd with new
data.

To fix, another condition variable is introduced, and async_send() waits
for a signal from send_thread() that the data was sent.

Reported-by: Igor Sukhih <igor@openvz.org>
Reported-by: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>