/// <summary> /// Constructor /// </summary> public ReadLock(System.Threading.ReaderWriterLock lk, System.TimeSpan timeout) { _lock = lk; if (null == _lock) { throw new System.ArgumentNullException("Error 2719124605: Null lock given"); } try { // If this thread already holds a write-lock then it is not possible // for other threads to hold read- or write-locks, so do nothing. // Note: this design assumes the scope of the write-lock held is bigger // than this instance. if (false == _lock.IsWriterLockHeld) { _lock.AcquireReaderLock(timeout); this._incrementCount(); //this._printCount(); } } catch (System.ApplicationException e) { System.Console.WriteLine("Error 3866214997: Failed to obtain lock for reading. {0}", e.Message); this._printCount(); throw; } }
private void initRefreshData() { // Create properties first. this.m_dataLock = new System.Threading.ReaderWriterLock(); this.m_dataModified = DateTime.Now; LoadAppSettings(); }
public void Dispose() { if (this.rwlock != null) { this.rwlock.DowngradeFromWriterLock(ref this.cookie); this.rwlock = null; } }
public Lock(System.Threading.ReaderWriterLock rwl, LockType lt) { rwlock = rwl; if (type == LockType.ForReading) rwl.AcquireReaderLock(-1); else if (type == LockType.ForWriting) rwl.AcquireWriterLock(-1); }
public void Dispose() { if (this.rwlock != null) { this.rwlock.ReleaseWriterLock(); this.rwlock = null; } }
/// <summary> /// Constructor /// </summary> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ReaderWriterLock" /> class. /// </para> /// </remarks> public ReaderWriterLock() { #if HAS_READERWRITERLOCK #if HAS_READERWRITERLOCKSLIM m_lock = new System.Threading.ReaderWriterLockSlim(); #else m_lock = new System.Threading.ReaderWriterLock(); #endif #endif }
/// <summary> /// Constructor /// </summary> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ReaderWriterLock" /> class. /// </para> /// </remarks> public ReaderWriterLock() { #if HAS_READERWRITERLOCK #if HAS_READERWRITERLOCKSLIM m_lock = new System.Threading.ReaderWriterLockSlim(System.Threading.LockRecursionPolicy.SupportsRecursion); #else m_lock = new System.Threading.ReaderWriterLock(); #endif #endif }
public Lock(System.Threading.ReaderWriterLock rwl, LockType lt) { rwlock = rwl; if (type == LockType.ForReading) rwl.AcquireReaderLock(-1); else if (type == LockType.ForWriting) rwl.AcquireWriterLock(-1); #if DEBUG callingfunction = new System.Diagnostics.StackTrace(); #endif }
public Lock(System.Threading.ReaderWriterLock rwl, LockType lt) { rwlock = rwl; if (type == LockType.ForReading) { rwl.AcquireReaderLock(-1); } else if (type == LockType.ForWriting) { rwl.AcquireWriterLock(-1); } }
/// <summary> /// <see cref="MMFrame.Windows.WindowMessaging.WindowMessageReceiver"/> オブジェクトを生成します。 /// </summary> public WindowMessageReceiver() { this.IsDisposed = false; this.Lock = new System.Threading.ReaderWriterLock(); this.CatchMessages = new System.Collections.Generic.HashSet <int>(); this.Events = new System.Collections.Generic.HashSet <System.Action <System.Windows.Forms.Message> >(); this.SynchronizationContext = System.ComponentModel.AsyncOperationManager.SynchronizationContext; System.Windows.Forms.CreateParams cp = new System.Windows.Forms.CreateParams(); cp.Caption = GetType().FullName; base.CreateHandle(cp); }
/// <summary> /// Creates a new vertex that can be added to a certain graph, but does not yet add it to the graph /// </summary> /// <param name="graph">The graph to which this vertex can be added</param> /// <param name="cls">The classification id of this vertex</param> public Vertex(Network graph, string label) { ID = Guid.NewGuid(); Network = graph; _predecessors = new Dictionary <Guid, Vertex>(); _successors = new Dictionary <Guid, Vertex>(); _incomingEdges = new Dictionary <Guid, Edge>(); _outgoingEdges = new Dictionary <Guid, Edge>(); _undirectedEdges = new Dictionary <Guid, Edge>(); _successorToEdgeMap = new Dictionary <Guid, Edge>(); _predecessorToEdgeMap = new Dictionary <Guid, Edge>(); _rwl = new System.Threading.ReaderWriterLock(); Label = label; }
/// <summary> /// Creates a new vertex that can be added to a certain graph, but does not yet add it to the graph /// </summary> /// <param name="graph"></param> /// <param name="id"></param> public Vertex(Network graph, Guid id) { ID = id; Network = graph; _predecessors = new Dictionary <Guid, Vertex>(); _successors = new Dictionary <Guid, Vertex>(); _incomingEdges = new Dictionary <Guid, Edge>(); _outgoingEdges = new Dictionary <Guid, Edge>(); _undirectedEdges = new Dictionary <Guid, Edge>(); _successorToEdgeMap = new Dictionary <Guid, Edge>(); _predecessorToEdgeMap = new Dictionary <Guid, Edge>(); _rwl = new System.Threading.ReaderWriterLock(); Label = ID.ToString(); }
public Lock(System.Threading.ReaderWriterLock rwl, LockType lt) { rwlock = rwl; if (type == LockType.ForReading) { rwl.AcquireReaderLock(-1); } else if (type == LockType.ForWriting) { rwl.AcquireWriterLock(-1); } #if DEBUG callingfunction = new System.Diagnostics.StackTrace(); #endif }
/// <summary> /// Construtor padrão. /// </summary> private ClassFactory() { var name = new System.Reflection.AssemblyName("DynamicClasses"); var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, System.Reflection.Emit.AssemblyBuilderAccess.Run); #if ENABLE_LINQ_PARTIAL_TRUST new ReflectionPermission(PermissionState.Unrestricted).Assert(); #endif try { module = assembly.DefineDynamicModule("Module"); } finally { #if ENABLE_LINQ_PARTIAL_TRUST PermissionSet.RevertAssert(); #endif } classes = new Dictionary <Signature, Type>(); rwLock = new System.Threading.ReaderWriterLock(); }
// Group: Functions // __________________________________________________________________________ /* Constructor: Locale */ static Locale() { localeCode = System.Globalization.CultureInfo.CurrentCulture.Name; if (String.IsNullOrEmpty(localeCode)) // Will be empty for the invariant culture { localeCode = "default"; } else { localeCode = localeCode.ToLower(); } translationFolders = new List <Path>(1); translationFolders.Add( Path.FromAssembly(System.Reflection.Assembly.GetExecutingAssembly()).ParentFolder + "/Translations" ); translations = new StringTable <StringToStringTable>(KeySettingsForLocaleNames); accessLock = new System.Threading.ReaderWriterLock(); pluralFormatterRegex = new Engine.Regex.Locale.PluralFormatter(); }
/// <summary> /// Constructor /// </summary> public WriteLock(System.Threading.ReaderWriterLock lk, System.TimeSpan timeout) { _lock = lk; if (null == _lock) { throw new System.ArgumentNullException("Error 2719124605: Null lock given"); } try { // If this thread holds a read-lock then it has to release it before // getting the write-lock. Otherwise, the attempt to acquire the // write-lock below will block. if (true == _lock.IsReaderLockHeld) { throw new System.Exception("Error 3637580726: Reader-lock is already held"); } _lock.AcquireWriterLock(timeout); } catch (System.ApplicationException e) { System.Console.WriteLine("Error 3725156970: Failed to obtain lock for writing. {0}", e.Message); throw; } }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { rwLock = new System.Threading.ReaderWriterLock(); }
/// <summary> /// 默认改造函数 /// </summary> public ObjectContainer_WuQi(ICacheStorage_WuQi <K, T> ics, ICacheDependency_WuQi <K, T> icd) { this.obj_dependency = icd; this.obj_containers = ics; this.obj_rwl = new System.Threading.ReaderWriterLock(); }
internal SyncStatementPhoneNumberCollection(StatementPhoneNumberCollection list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
internal SyncLocalNamespaceList(LocalNamespaceListBase list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
internal SyncDoubleCollection(DoubleCollection list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
public WriterLock(System.Threading.ReaderWriterLock rwlock) : this(rwlock, System.Threading.Timeout.Infinite) { }
internal SyncPreviousPaymentCollection(PreviousPaymentCollection list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
internal WriterLockUpgraded(System.Threading.ReaderWriterLock rwlock) : this(rwlock, System.Threading.Timeout.Infinite) { }
internal SyncServiceCategoryCollection(ServiceCategoryCollection list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
/// <summary> /// Constructs a new DOLEventHandler collection /// </summary> public RoadEventHandlerCollection() { m_lock = new System.Threading.ReaderWriterLock(); m_events = new HybridDictionary(); }
internal SyncMailAddressList(MailAddressList list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
internal SyncMarketLogVector( MarketLogVector list ) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
/// <summary> /// Constructor /// </summary> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ReaderWriterLock" /> class. /// </para> /// </remarks> public ReaderWriterLock() { #if HAS_READERWRITERLOCK m_lock = new System.Threading.ReaderWriterLock(); #endif }
internal SyncMarketLogVector(MarketLogVector list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
internal SyncQuestionCollection(QuestionCollection list) : base(Tag.Default) { rwLock = new System.Threading.ReaderWriterLock(); collection = list; }
public ReaderLock(System.Threading.ReaderWriterLock rwlock, int milliSeconds) { this.rwlock = rwlock; this.rwlock.AcquireReaderLock(milliSeconds); }
internal SyncPropertyCollection(PropertyCollection list) : base(Tag.Default) { _rwLock = new System.Threading.ReaderWriterLock(); _collection = list; }
/// <summary> /// Constructor /// </summary> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ReaderWriterLock" /> class. /// </para> /// </remarks> public ReaderWriterLock() { m_lock = new System.Threading.ReaderWriterLock(); }
internal WriterLockUpgraded(System.Threading.ReaderWriterLock rwlock, int milliSeconds) { this.cookie = rwlock.UpgradeToWriterLock(milliSeconds); this.rwlock = rwlock; }