module

Pomtex::Core::CacheLock

Coordinates pomtex processes that share one cache (e.g. pomtex watch in one terminal and pomtex build in another) with an flock on <cache>/.lock.

  • exclusive: anything that writes the cache (planting arils, growing the rind, rebuilding the index, remove/clean)
  • shared: engine runs, so the tree cannot be removed underneath a compile

Locks are re-entrant within a process. Taking an exclusive lock while holding a shared one converts it. flock conversion is not atomic: a conversion that has to wait drops the shared lock first, so two compiles that both need to fetch cannot deadlock. Callers must re-check the cache state after acquiring, because another process may have done the work already.

Instance methods

exclusive
Source
held
Source
shared
Source

Nested types