File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,19 @@ data LedgerDBEnv m l blk = LedgerDBEnv
458458 , ldbResolveBlock :: ! (ResolveBlock m blk )
459459 , ldbQueryBatchSize :: ! QueryBatchSize
460460 , ldbOpenHandlesLock :: ! (RAWLock m LDBLock )
461+ -- ^ While holding a read lock (at least), all handles in the 'ldbSeq' are
462+ -- guaranteed to be open. During this time, the handle can be duplicated and
463+ -- then be used independently, see 'getStateRef' and 'withStateRef'.
464+ --
465+ -- Therefore, closing any handles which were previously in 'ldbSeq' requires
466+ -- acquiring a write lock. Concretely, both of the following approaches are
467+ -- fine:
468+ --
469+ -- * Modify 'ldbSeq' without any locking, and then close the removed handles
470+ -- while holding a write lock. See e.g. 'closeForkerEnv'.
471+ --
472+ -- * Modify 'ldbSeq' while holding a write lock, and then close the removed
473+ -- handles without any locking.
461474 }
462475 deriving Generic
463476
You can’t perform that action at this time.
0 commit comments