Utilities for working with multithreaded workers for Julia services and applications
The package is registered in the General registry and so can be installed at the REPL with ] add ConcurrentUtilities.
Each utility has a docstring with details, for example ?Pool in the REPL.
Pool,acquire,release,drain!: a thread-safe pool of reusable objects, optionally keyed, that limits how many objects are in use at once.ReadWriteLock,readlock,readunlock: a lock that allows many readers or one writer (Julia 1.8+).FIFOLock: a reentrant lock that waiting tasks acquire in arrival order (Julia 1.10+).Lockable: a value paired with the lock that guards it;lock(f, l)callsf(value)with the lock held.OrderedSynchronizer: lets concurrent tasks run a step in a fixed order withput!(f, sync, i).try_with_timeout: runsfin a task and throwsTimeoutExceptionif it does not finish in time.Worker,remote_eval,remote_fetch,terminate!: run code in a separate Julia process.@wkspawn: likeThreads.@spawn, but the finished task drops its code and task-local storage so they can be garbage collected.ConcurrentUtilities.initandConcurrentUtilities.@spawn: run tasks on a fixed set of background worker tasks.@spawnwaits for a free worker, so callinitfirst.