git-svn-id: svn://db.shs.com.ru/pip@180 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -359,6 +359,7 @@ bool PIBinaryLog::checkFileHeader() {
|
|||||||
|
|
||||||
|
|
||||||
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
||||||
|
logmutex.lock();
|
||||||
PIByteArray ba;
|
PIByteArray ba;
|
||||||
BinLogRecord br;
|
BinLogRecord br;
|
||||||
lastrecord.id = 0;
|
lastrecord.id = 0;
|
||||||
@@ -369,6 +370,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
|||||||
ba >> br.id >> br.size >> br.timestamp;
|
ba >> br.id >> br.size >> br.timestamp;
|
||||||
} else {
|
} else {
|
||||||
br.id = -1;
|
br.id = -1;
|
||||||
|
logmutex.unlock();
|
||||||
return br;
|
return br;
|
||||||
}
|
}
|
||||||
if (br.id > 0 && br.size > 0) {
|
if (br.id > 0 && br.size > 0) {
|
||||||
@@ -379,6 +381,7 @@ PIBinaryLog::BinLogRecord PIBinaryLog::readRecord() {
|
|||||||
lastrecord = br;
|
lastrecord = br;
|
||||||
if (br.id == 0) fileError();
|
if (br.id == 0) fileError();
|
||||||
moveIndex(index_pos.value(file.pos(), -1));
|
moveIndex(index_pos.value(file.pos(), -1));
|
||||||
|
logmutex.unlock();
|
||||||
return br;
|
return br;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,12 +500,14 @@ bool PIBinaryLog::createIndex() {
|
|||||||
|
|
||||||
|
|
||||||
void PIBinaryLog::seekTo(int rindex) {
|
void PIBinaryLog::seekTo(int rindex) {
|
||||||
|
logmutex.lock();
|
||||||
if (rindex < index.size_s() && rindex >= 0) {
|
if (rindex < index.size_s() && rindex >= 0) {
|
||||||
file.seek(index[rindex].pos);
|
file.seek(index[rindex].pos);
|
||||||
moveIndex(index_pos.value(file.pos(), -1));
|
moveIndex(index_pos.value(file.pos(), -1));
|
||||||
play_time = index[rindex].timestamp.toMilliseconds();
|
play_time = index[rindex].timestamp.toMilliseconds();
|
||||||
lastrecord.timestamp = index[rindex].timestamp;
|
lastrecord.timestamp = index[rindex].timestamp;
|
||||||
}
|
}
|
||||||
|
logmutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ private:
|
|||||||
PIFile file;
|
PIFile file;
|
||||||
BinLogRecord lastrecord;
|
BinLogRecord lastrecord;
|
||||||
PISystemTime startlogtime, play_delay, split_time;
|
PISystemTime startlogtime, play_delay, split_time;
|
||||||
|
PIMutex logmutex;
|
||||||
double play_time, play_speed;
|
double play_time, play_speed;
|
||||||
llong split_size;
|
llong split_size;
|
||||||
int write_count, split_count, default_id, current_index;
|
int write_count, split_count, default_id, current_index;
|
||||||
|
|||||||
Reference in New Issue
Block a user