C# 클래스 GSF.Threading.TinyLock

Provides a light weight exclusive lock that is approximately 2.5 times faster than Monitor. WARNING: This lock should be used in a Using block, and duplicate calls to Lock without releasing will cause a deadlock.
After writing this class I did some review of the methodology. Reviewing this article: http://www.adammil.net/blog/v111_Creating_High-Performance_Locks_and_Lock-free_Code_for_NET_.html Brings up stability issues with the lock. Namely what happens when unhandled exceptions occurs when acquiring and releasing the lock. I have intentionally left out any kind of protection against this as it severly reduces the speed of this code. Therefore do not use this locking method where a Thread.Abort() might be used as a control method.
파일 보기 프로젝트 열기: GridProtectionAlliance/openHistorian 1 사용 예제들

공개 메소드들

메소드 설명
TinyLock ( ) : System

Creates a TinyLock

비공개 메소드들

메소드 설명
Lock ( ) : TinyLockRelease
LockSlower ( ) : void

A nested call since 99% of the time, there will not be contention. This prevents stack space being used for the SpinLock when its not needed.

메소드 상세

TinyLock() 공개 메소드

Creates a TinyLock
public TinyLock ( ) : System
리턴 System