Add locks to FileStream

This commit is contained in:
Angelos Katharopoulos
2024-05-08 23:19:27 -07:00
parent bae159738f
commit 8242d6d5ef
3 changed files with 27 additions and 2 deletions

View File

@@ -150,11 +150,21 @@ class PyFileReader : public io::Reader {
return "python file object";
}
void lock() override {
stream_mutex_.lock();
}
void unlock() override {
stream_mutex_.unlock();
}
private:
nb::object pyistream_;
nb::object readinto_func_;
nb::object seek_func_;
nb::object tell_func_;
std::mutex stream_mutex_;
};
std::pair<