Enum ScyllaCollectionThreadSafety
Enumerates the thread-safety guarantees that a Scylla collection instance provides for its operations.
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public enum ScyllaCollectionThreadSafety
Remarks
Scylla collections are Unsynchronized by default for maximum single-threaded
performance. Thread-safe usage is opt-in and is provided through explicit synchronized
decorator wrappers (e.g. ScyllaQueue<T>.SynchronizedScyllaQueue) that
report Synchronized and expose a stable, non-null
SyncRoot.
Always check ThreadSafety before assuming a collection instance can be accessed from multiple threads. The property is the authoritative source of the safety contract; do not infer thread safety from the concrete type name alone, as both the raw type and its synchronized wrapper implement IScyllaCollection<T>.
Example - conditional synchronized access:
if (collection.ThreadSafety == ScyllaCollectionThreadSafety.Unsynchronized)
{
// Must be accessed from a single thread, or protected externally.
}
else if (collection.ThreadSafety == ScyllaCollectionThreadSafety.Synchronized)
{
// Safe to call from multiple threads; internal lock is applied per-operation.
// For atomic multi-step sequences, lock on collection.SyncRoot.
}
Fields
| Name | Description |
|---|---|
| LockFree | Operations on the collection use lock-free techniques (e.g. |
| Synchronized | All operations on the collection are protected by an internal lock, making them safe to call concurrently from multiple threads without additional external synchronization. |
| Unsynchronized | The collection performs no internal synchronization. Concurrent access from multiple threads without external coordination is undefined behavior and may corrupt internal state. |