Skip to content

ConcurrentAccess

Namespace: ThinkGeo.Core

Says how something that reads map data behaves when more than one thread wants it at once, and what a caller who wants concurrency should therefore do with it.

public enum ConcurrentAccess

Inheritance object → ValueType → Enum → ConcurrentAccess
Implements IComparable, IConvertible, IFormattable

Remarks:

This answers both halves of the question in one value. Whether two threads may read at once is the thing only the implementation knows; when they may not, whether a copy or a lock is the cheaper way out is also something only the implementation knows, because it depends on what the object carries in memory. goes through the serializer, so a copy costs whatever the object is holding - a path and a file handle for a file-backed source, every feature for one whose data is in memory.

The value says what is permitted and cheap, not what a caller must do. A caller is free to lock a source that would allow copying - the screen renderer always has.

https://community.thinkgeo.com/t/features-cut-off-on-tile-border-with-gpu-rendering/12481

Fields

Name Value Description
UnsafeLock 0 Two threads must not read at once, and a copy is not the way to get around it -
either because copying is expensive, or because the data can change underneath and
a copy would go on answering from the moment it was taken. Callers share the one
instance and take turns on it. This is the default, and it is never wrong, only
sometimes slower than it had to be.
UnsafeClone 1 Two threads must not read at once, but a copy per worker is cheap and does not go
stale - a file-backed source, whose data sits on disk and whose copy is little more
than a path. Callers that want concurrency copy it; callers that do not, or whose
copy fails, fall back to taking turns.
Safe 2 Reads are answered independently, so one instance serves every thread - a source
that opens a connection per call, or one whose reads touch nothing shared. No copy
and no lock.