#include "log.h"
#include "metacube2.h"
-#include "mutexlock.h"
#include "state.pb.h"
#include "stream.h"
#include "util.h"
if (data_fd == -1) {
exit(1);
}
-
- pthread_mutex_init(&queued_data_mutex, nullptr);
}
Stream::~Stream()
encoding(Stream::STREAM_ENCODING_RAW), // Will be changed later.
data_fd(data_fd),
backlog_size(serialized.backlog_size()),
- prebuffering_bytes(serialized.prebuffering_bytes()),
bytes_received(serialized.bytes_received())
{
if (data_fd == -1) {
}
suitable_starting_points.push_back(point);
}
-
- pthread_mutex_init(&queued_data_mutex, nullptr);
}
StreamProto Stream::serialize()
serialized.set_stream_header(stream_header);
serialized.add_data_fds(data_fd);
serialized.set_backlog_size(backlog_size);
- serialized.set_prebuffering_bytes(prebuffering_bytes);
serialized.set_bytes_received(bytes_received);
for (size_t point : suitable_starting_points) {
serialized.add_suitable_starting_point(point);
return;
}
- MutexLock lock(&queued_data_mutex);
+ lock_guard<mutex> lock(queued_data_mutex);
DataElement data_element;
data_element.metacube_flags = metacube_flags;
// Hold the lock for as short as possible, since add_data_raw() can possibly
// write to disk, which might disturb the input thread.
{
- MutexLock lock(&queued_data_mutex);
+ lock_guard<mutex> lock(queued_data_mutex);
if (queued_data.empty()) {
return;
}