Click or drag to resize

CCriticalSection Class

Critical Section synchronization between threads.
Inheritance Hierarchy
SystemObject
  Crestron.SimplSharpCCriticalSection

Namespace: Crestron.SimplSharp
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public class CCriticalSection : IDisposable

The CCriticalSection type exposes the following members.

Constructors
 NameDescription
Public methodCCriticalSection Initialize the Critical Section object.
Top
Properties
 NameDescription
Public propertyDisposed Property to indicate if the Critical Section object has been disposed.
Top
Methods
 NameDescription
Public methodDispose Clean up of unmanaged resources.
Protected methodDispose(Boolean) Dispose implementation
Public methodEnter Block until ownership of the critical section can be obtained.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalize Make sure unmanaged handle is cleaned up from the finalizer.
(Overrides ObjectFinalize)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodLeave Release ownership of the critical section.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryEnter Attempt to enter the critical section without blocking.
Top
Example
This is how we would use a CriticalSection
C#
// Initialize the critical section
CCriticalSection tempCS = new CCriticalSection();
// Enter the critical section
tempCs.Enter();
// Do anything critical in here
// ..
// ..
// Leave the critical section
tempCs.Leave();

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also