Language

ResourceAccessMode Enum

Definition

Specifies how a test accesses a resource declared with ResourceLockAttribute.

public enum ResourceAccessMode
type ResourceAccessMode = 
Public Enum ResourceAccessMode
Inheritance
ResourceAccessMode

Fields

Name Value Description
ReadWrite 0

The test reads and writes the resource. The lock is exclusive: it blocks against all other readers and writers of the same resource. This is the default.

Read 1

The test only reads the resource. Read locks run concurrently with each other and block only against a ReadWrite holder.

Remarks

ReadWrite is deliberately the zero value, so that a default-initialized ResourceAccessMode is the exclusive (safe) mode. Under-locking produces flaky races, while over-locking merely runs slower, so any unspecified value must fail closed.

Applies to