Skip to content

Threading and async usage

Andrew Kolman edited this page Jan 15, 2024 · 1 revision

An EggArchive instance should be thread-safe as it contains no mutable members once parsing is complete (i.e. construction). The same goes for EggArchiveEntry. However, any Stream produced by EggArchiveEntry.Open will produce a sub-stream of the underlying Stream instance provided during construction. At this time there is no synchronization internally [within EggDotNet], so operating on multiple EggArchiveEntry streams at the same time is not supported. However, EggDotNet does track the expected position on the underlying stream, so external locking should allow safe reads. This also means that a stream provided by EggArchiveEntry.Open can be used asynchronously, provided that only one read is occurring at a time.

Clone this wiki locally