Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

LockCookie Structure

Defines the lock that implements single-writer/multiple-reader semantics. This is a value type.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

[<Sealed>]
[<ComVisibleAttribute(true)>]
type LockCookie =  struct end

The LockCookie type exposes the following members.

  NameDescription
Public methodEquals(LockCookie)Indicates whether the current instance is equal to the specified LockCookie.
Public methodEquals(Object)Indicates whether a specified object is a LockCookie and is equal to the current instance. (Overrides ValueType.Equals(Object).)
Public methodGetHashCodeReturns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)
Top

  NameDescription
Public operatorStatic memberEqualityIndicates whether two LockCookie structures are equal.
Public operatorStatic memberInequalityIndicates whether two LockCookie structures are not equal.
Top

The following example shows how to request a reader lock, upgrade the reader lock to a writer lock, and save the LockCookie. It then uses the LockCookie to downgrade to a reader lock again.

This code is part of a larger example provided for the ReaderWriterLock class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

This type is thread safe.

Show:
© 2015 Microsoft