diff --git a/src/dwarfs/filesystem_writer.cpp b/src/dwarfs/filesystem_writer.cpp index 731fddd6..1315b57f 100644 --- a/src/dwarfs/filesystem_writer.cpp +++ b/src/dwarfs/filesystem_writer.cpp @@ -358,7 +358,6 @@ filesystem_writer_::filesystem_writer_( , metadata_bc_(metadata_bc) , options_(options) , LOG_PROXY_INIT(lgr) - , pctx_{prog.create_context()} , flush_(false) , writer_thread_(&filesystem_writer_::writer_thread, this) { if (header_) { @@ -486,6 +485,10 @@ uint32_t filesystem_writer_::write_section( { std::unique_lock lock(mx_); + if (!pctx_) { + pctx_ = prog_.create_context(); + } + while (mem_used() > options_.max_queue_size) { cond_.wait(lock); }