FifoBuffer::FifoBuffer(size_t size)
: state_(SS_OPEN),
buffer_(newchar[size]),
buffer_length_(size),
data_length_(0),
read_position_(0),
owner_(TaskQueueBase::Current()) { // all events are done on the owner_ thread
}
FifoBuffer::FifoBuffer(size_t size, TaskQueueBase* owner)
: state_(SS_OPEN),
buffer_(newchar[size]),
buffer_length_(size),
data_length_(0),
read_position_(0),
owner_(owner) { // all events are done on the owner_ thread
}
if (result == SR_SUCCESS) { // If read was successful then adjust the read position and number of // bytes buffered.
read_position_ = (read_position_ + copy) % buffer_length_;
data_length_ -= copy;
bytes_read = copy;
// if we were full before, and now we're not, post an event if (!was_writable && copy > 0) {
PostEvent(SE_WRITE, 0);
}
} return result;
}
if (result == SR_SUCCESS) { // If write was successful then adjust the number of readable bytes.
data_length_ += copy;
bytes_written = copy; // if we didn't have any data to read before, and now we do, post an event if (!was_readable && copy > 0) {
PostEvent(SE_READ, 0);
}
} return result;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.