diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-06-11 03:09:11 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-06-11 03:54:45 +0200 |
commit | ed9508da27c3ef0803bfd1e600465a5eb6566441 (patch) | |
tree | d3ead3c15039d34625c1e0d2792568632ad35eb2 /crawl-ref/source/package.cc | |
parent | 54bb2f12a0f4e35c987d465343882a858e3f8f64 (diff) | |
download | crawl-ref-ed9508da27c3ef0803bfd1e600465a5eb6566441.tar.gz crawl-ref-ed9508da27c3ef0803bfd1e600465a5eb6566441.zip |
Assert out when committing a save when there are readers or writers.
Crawl never needs that, but if that ever changes (or someone reuses the
transactional filesystem-in-a-file elsewhere), there are potential problems
that, while easy to fix, would require that effort.
Diffstat (limited to 'crawl-ref/source/package.cc')
-rw-r--r-- | crawl-ref/source/package.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc index d8fa6a887e..5ac89b8eb0 100644 --- a/crawl-ref/source/package.cc +++ b/crawl-ref/source/package.cc @@ -14,9 +14,10 @@ Caveats/issues: * A commit() will break readers who read a chunk that was deleted or overwritten. Not that it's a sane thing to do... Writers don't have any such limitations, an uncompleted write will be not committed yet - but won't be corrupted. + but won't be corrupted. [Currently not allowed] * Readers ignore uncompleted writes; completed but not committed ones will - be available immediately -- yet a crash will lose them. + be available immediately -- yet a crash will lose them. Ie, this is known + as READ_UNCOMMITTED. */ #include "AppHdr.h" @@ -205,6 +206,10 @@ void package::commit() return; ASSERT(!aborted); + // Not a hard requirement, we'd have to pin chunks that are being read so + // the commit won't free them. + ASSERT(!n_users); + #ifdef COSTLY_ASSERTS fsck(); #endif |