Skip to content

Commit e8f69f7

Browse files
committed
Clear binary io
1 parent 1f3e962 commit e8f69f7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backends/common/default_binary_io.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ luisa::filesystem::path DefaultBinaryIO::write_internal_shader(luisa::string_vie
240240
}
241241

242242
void DefaultBinaryIO::clear_shader_cache() const noexcept {
243-
if (!_use_lmdb) return;
244-
_cache_lmdb.destroy();
243+
std::lock_guard lck{_global_mtx};
244+
if (_use_lmdb) {
245+
_cache_lmdb.destroy();
246+
}
245247
std::error_code ec;
246248
for (auto &&dir : std::filesystem::directory_iterator(_cache_dir)) {
247249
std::filesystem::remove_all(dir, ec);
@@ -251,7 +253,9 @@ void DefaultBinaryIO::clear_shader_cache() const noexcept {
251253
to_string(dir), ec.message());
252254
}
253255
}
254-
_cache_lmdb.create(_cache_dir);
256+
if (_use_lmdb) {
257+
_cache_lmdb.create(_cache_dir);
258+
}
255259
}
256260

257261
}// namespace luisa::compute

0 commit comments

Comments
 (0)