C# Class Library.DeadlockMonitor

Afficher le fichier Open project: Alliance-Network/Library Class Usage Examples

Méthodes publiques

Méthode Description
Enter ( object monitor ) : void

Acquires an exclusive lock on the specified object.

Exit ( object monitor ) : void

Releases an exclusive lock on the specified object.

Lock ( object monitor ) : IDisposable

Locks the specified object and returns an IDisposable that can be used to release the lock.

TryEnter ( object monitor ) : bool

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.

TryEnter ( object monitor, System.TimeSpan timeout ) : bool

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.

TryEnter ( object monitor, int millisecondsTimeout ) : bool

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.

Private Methods

Méthode Description
CreateDeadlockDescription ( CycleComponentNode currentChain, Dictionary locksHeldByThreads ) : string

Creates a textual description of the deadlock.

CreateThreadAndLockTables ( Dictionary &locksHeldByThreads, Dictionary &threadsWaitingOnLocks ) : void

Generates mapping tables based on the data in _monitorStates.

ThrowIfDeadlockDetected ( MonitorState targetMs ) : void

Throws an exception if a deadlock would be caused by the current thread waiting on the specified lock.

Method Details

Enter() public static méthode

Acquires an exclusive lock on the specified object.
public static Enter ( object monitor ) : void
monitor object The object on which to acquire the monitor lock.
Résultat void

Exit() public static méthode

Releases an exclusive lock on the specified object.
public static Exit ( object monitor ) : void
monitor object Releases an exclusive lock on the specified object.
Résultat void

Lock() public static méthode

Locks the specified object and returns an IDisposable that can be used to release the lock.
public static Lock ( object monitor ) : IDisposable
monitor object The object on which to acquire the monitor lock.
Résultat IDisposable

TryEnter() public static méthode

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.
public static TryEnter ( object monitor ) : bool
monitor object The object on which to acquire the lock.
Résultat bool

TryEnter() public static méthode

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.
public static TryEnter ( object monitor, System.TimeSpan timeout ) : bool
monitor object The object on which to acquire the lock.
timeout System.TimeSpan A TimeSpan representing the amount of time to wait for the lock. A value of -1 millisecond specifies an infinite wait.
Résultat bool

TryEnter() public static méthode

Attempts, for the specified amount of time, to acquire an exclusive lock on the specified object.
public static TryEnter ( object monitor, int millisecondsTimeout ) : bool
monitor object The object on which to acquire the lock.
millisecondsTimeout int The number of milliseconds to wait for the lock.
Résultat bool