Click or drag to resize

com.espertech.esper.compat.threading.locks Namespace

[Missing <summary> documentation for "N:com.espertech.esper.compat.threading.locks"]

Classes
  ClassDescription
Public classDefaultLockManager
Public classDefaultReaderWriterLockManager
Public classDummyReaderWriterLock
Uses a standard lock to model a reader-writer ... not for general use
Public classFairReaderWriterLock
Public classFifoReaderWriterLock
Public classFifoReaderWriterLockNode
Public classLockableExtensions
Public classLockConstants
Constants we keep for our locking algorithms.
Public classMonitorLock
MonitorLock is a class for assisting people with synchronized operations. Traditionally, code might have looked something like this:
lock( object ) { 
  ...
}
However, this has a few issues. It's prone to deadlock because the lock operator does not have a timeout. It's also difficult to determine who owns a lock at a given time. So eventually people changed to this form:
if (Monitor.TryEnter(object, timeout)) {
  try {
   ...
  } finally {
    Monitor.Exit(object);
  }
}
It gets bulky and begins to become difficult to maintain over time. MonitorLock works much like the lock( object ) model except that it relies upon the IDisposable interface to help with scoping of the lock. So to use MonitorLock, first instantiate one and then replace your lock(object) with this:
using(lockObj.Acquire()) {
  ...
}
Your code will work as before except that the monitorLock will use a timed entry into critical sections and it can be used to diagnose issues that may be occuring in your thread locking.

MonitorLock allows users to specify events that can be consumed on lock acquisition or release. Additionally, it can inform you when a lock is acquired within an existing lock. And last, if you want to know where your locks are being acquired, it can maintain a StackTrace of points where allocations are occuring.

Public classMonitorSlimLock
Public classMonitorSpinLock
Public classSlimLock
: a simple spinLock algorithm. The spinLock will attempt to exchange a value atomically. If the exchange can not be done then the spinLock will enter a loop for a maximum amount of time as specified. In the loop it will use a spinWait to allow the CPU to idle for a few cycles in an attempt to wait for the resource to be freed up. If after a number of attempts the resource has not been freed, the spinLock will give up its quanta using a sleep. The sleep will force the thread to yield and if all goes well releases the thread (which may be on the same processor) to release the critical resource. There's no reason to use this as a general purpose lock, monitors do just fine.
Public classSlimReaderWriterLock
Public classStandardReaderWriterLock
Public classTelemetryEngine
Public classTelemetryEventArgs
Public classTelemetryLock
Public classTelemetryLockCategory
Public classTelemetryProbe
Public classTelemetryReaderWriterLock
Public classVoidLock
Public classVoidReaderWriterLock
Interfaces