[MERGE] Fix to relay stream locking

Signed-off-by: David Goulet <dgoulet@efficios.com>
[HEAD MERGE] REVIEW CAREFULLY : test for new metadata at each packet

After sending each data packet in live, we need to check if new metadata
is available before sending the index informing the viewer it can read
the trace.
Since the data and the metadata are handled by two different threads,
this patch introduces a rendez-vous point : if new metadata is
available, the data thread flushes the metadata stream and waits on a
conditionnal variable. When the metadata thread finishes to send its
data, it wakes up the data thread which can send its index.

That way, the viewer is informed new metadata is available before
attempting to read a packet that might require an update of the
metadata.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
[MERGE] Review and merge sync_metadata in one call

Signed-off-by: David Goulet <dgoulet@efficios.com>
[MERGE] fix sync metadata return code and clarify some comments

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>