fix: add notify when unreadlock

This commit is contained in:
2023-12-12 08:32:19 +00:00
parent a0150ec6fb
commit c7f5e249c8
4 changed files with 16 additions and 11 deletions

View File

@ -8,7 +8,7 @@ BlockingStringStream &BlockingStringStream::getline(std::string &str,
condition.wait(lock, [this] {
return internalStream.peek() != EOF && !is_writing;
});
str = "";
std::getline(internalStream, str, delim);
return *this;
@ -53,4 +53,7 @@ void debugPrint() {
}
void BlockingStringStream::readlock() { is_writing = true; }
void BlockingStringStream::unreadlock() { is_writing = false; }
void BlockingStringStream::unreadlock() {
is_writing = false;
condition.notify_all();
}