C# Class Subtext.Framework.Threading.TimedLock

Class provides a nice way of obtaining a lock that will time out with a cleaner syntax than using the whole Monitor.TryEnter() method.
Adapted from Ian Griffiths article http://www.interact-sw.co.uk/iangblog/2004/03/23/locking and incorporating suggestions by Marek Malowidzki as outlined in this blog post http://www.interact-sw.co.uk/iangblog/2004/05/12/timedlockstacktrace
Afficher le fichier Open project: ayende/Subtext Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void

Disposes of this lock.

Lock ( object o ) : TimedLock

Attempts to obtain a lock on the specified object for up to 10 seconds.

Lock ( object o, System.TimeSpan timeout ) : TimedLock

Attempts to obtain a lock on the specified object for up to the specified timeout.

Private Methods

Méthode Description
TimedLock ( object o ) : System

Method Details

Dispose() public méthode

Disposes of this lock.
public Dispose ( ) : void
Résultat void

Lock() public static méthode

Attempts to obtain a lock on the specified object for up to 10 seconds.
public static Lock ( object o ) : TimedLock
o object
Résultat TimedLock

Lock() public static méthode

Attempts to obtain a lock on the specified object for up to the specified timeout.
public static Lock ( object o, System.TimeSpan timeout ) : TimedLock
o object
timeout System.TimeSpan
Résultat TimedLock