private static void LockOnReaderWriterLock() { Console.WriteLine("About to lock on the ReaderWriterLock. Debug after seeing \"Signaled to acquire the reader lock.\""); ReaderWriterLock rwLock = new ReaderWriterLock(); ManualResetEvent rEvent = new ManualResetEvent(false); ManualResetEvent pEvent = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem((object state) => { rwLock.AcquireWriterLock(-1); Console.WriteLine("Writer lock acquired!"); rEvent.Set(); pEvent.WaitOne(); }); rEvent.WaitOne(); Console.WriteLine("Signaled to acquire the reader lock."); rwLock.AcquireReaderLock(-1); Console.WriteLine("Reader lock acquired"); pEvent.Set(); Console.WriteLine("About to end the program. Press any key to exit."); Console.ReadKey(); }
public ExpansionStore() { _loaded = false; _cache = null; _lock = new ReaderWriterLock(); }
/// <summary> /// Initializes the StrengthenMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _ally = new Dictionary <string, int>(); if (!Load(_ally)) { return(false); } _consortia = new Dictionary <int, ConsortiaInfo>(); if (!LoadConsortia(_consortia)) { return(false); } return(true); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("ConsortiaMgr", e); } return(false); } }
static InstrumentedAssembly() { InstrumentedAssembly.readerWriterLock = new ReaderWriterLock(); InstrumentedAssembly.mapIDToPublishedObject = new Hashtable(); InstrumentedAssembly.mapPublishedObjectToID = new Hashtable(); InstrumentedAssembly.upcountId = 0xeff; }
public static bool Init() { try { //_RateInfo = new ExperienceRateInfo(); //_RateInfo.Rate = 1; m_lock = new System.Threading.ReaderWriterLock(); using (ServiceBussiness db = new ServiceBussiness()) { _RateInfo = db.GetExperienceRate(WorldMgr.ServerID); } if (_RateInfo == null) { _RateInfo = new ExperienceRateInfo(); _RateInfo.Rate = -1; } return(true); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("ExperienceRateMgr", e); } return(false); } }
public UpBuffer(string string_0) { this.list_0 = new List<int>(30); this.readerWriterLock_0 = new ReaderWriterLock(); this.hashtable_0 = Hashtable.Synchronized(new Hashtable(0xa3)); this.AlarmCodeList = string_0; }
// Use this for initialization void Start() { System.Net.Sockets.TcpClient sock = new System.Net.Sockets.TcpClient(); sock.Connect(address, port); if (!sock.Connected) { Debug.Log("Twitch contact failed"); return; } eventQueue = new Queue <Queue <string> >(); outputQueue = new Queue <string>(); inLock = new System.Threading.ReaderWriterLock(); outLock = new System.Threading.ReaderWriterLock(); netStream = sock.GetStream(); read = new System.IO.StreamReader(netStream); write = new System.IO.StreamWriter(netStream); write.WriteLine("PASS " + oath); write.WriteLine("NICK " + username); write.Flush(); messages = new Queue <string>(); procIn = new System.Threading.Thread(() => IRCInputProcedure()); procIn.Start(); procOut = new System.Threading.Thread(() => IRCOutputProcedure()); procOut.Start(); Debug.Log("We're in"); }
public CharacterStore() { _loaded = false; _cache = new List<Character>(); _lock = new ReaderWriterLock(); }
public RoleStore() { _loaded = false; _cache = new List<Role>(); _lock = new ReaderWriterLock(); }
public SpecializationStore() { _loaded = false; _cache = new List<Specialization>();; _lock = new ReaderWriterLock(); }
public override void InitializeConfiguration() { _Entities = new IdentityMap(); _Scalars = new Dictionary<string,object>(); _Loads = new Hashtable(); _RWL = new ReaderWriterLock(); }
public RaceClassesStore() { _loaded = false; _cache = null; _lock = new ReaderWriterLock(); }
/// <summary> /// Executes a job on demand, rather than waiting for its regularly scheduled time. /// </summary> /// <param name="job">The job to be executed.</param> public static void ExecuteJob(JobBase job) { ReaderWriterLock rwLock = new ReaderWriterLock(); try { rwLock.AcquireReaderLock(Timeout.Infinite); if (job.Executing == false) { LockCookie lockCookie = rwLock.UpgradeToWriterLock(Timeout.Infinite); try { if (job.Executing == false) { job.Executing = true; QueueJob(job); } } finally { rwLock.DowngradeFromWriterLock(ref lockCookie); } } } finally { rwLock.ReleaseReaderLock(); } }
// Use this for initialization void Start() { inst = this; server = new System.Net.Sockets.TcpClient(); server.Connect(address, port); if (!server.Connected) { Debug.Log("Failed to connect!"); return; } Debug.Log("Connected"); inputQueue = new Queue <string>(); outputQueue = new Queue <string>(); netStream = server.GetStream(); read = new System.IO.StreamReader(netStream); write = new System.IO.StreamWriter(netStream); outlock = new System.Threading.ReaderWriterLock(); inlock = new System.Threading.ReaderWriterLock(); write.WriteLine("PASS " + oath); write.WriteLine("NICK " + username.ToLower()); write.Flush(); procIn = new System.Threading.Thread(() => IRCInputProcedure()); procIn.Start(); procOut = new System.Threading.Thread(() => IRCOutputProcedure()); procOut.Start(); Debug.Log("We're in"); }
public static string getOneCell() { string encodedOrder=null; readSem.WaitOne();// wait until buffer cell is not empty then only read ReaderWriterLock rw=new ReaderWriterLock(); rw.AcquireWriterLock(Timeout.Infinite); try{ //reading from buffer --- ciruclar queue if (front_read == bufferSize - 1) front_read = 0; else { front_read = front_read + 1; } encodedOrder = buffer[front_read]; buffer[front_read] = string.Empty; String[] arr=encodedOrder.Split('#'); Console.WriteLine(" chicken farm got an order from {0} of {1} chicken",arr[0],arr[2]); } catch (Exception e){ Console.WriteLine(""); } finally { rw.ReleaseWriterLock(); writeSem.Release(); } return encodedOrder; }
public static bool Init() { try { //_RateInfo = new ExperienceRateInfo(); //_RateInfo.Rate = 1; m_lock = new System.Threading.ReaderWriterLock(); using (ServiceBussiness db = new ServiceBussiness()) { _RateInfo = db.GetExperienceRate(WorldMgr.ServerID); } if (_RateInfo == null) { _RateInfo = new ExperienceRateInfo(); _RateInfo.Rate = -1; } return true; } catch (Exception e) { if (log.IsErrorEnabled) log.Error("ExperienceRateMgr", e); return false; } }
public ReaderLock(ReaderWriterLock rwLock) { if (null == rwLock) throw new Exception("Don't pass a null ReaderWriterLock object!"); _lock = rwLock; _lock.AcquireReaderLock(Timeout.Infinite); }
private DatabaseResource(string path) { Path = path; _refCount = 1; SessionFactory = SessionFactoryFactory.CreateSessionFactory(path, ProteomeDb.TYPE_DB, false); DatabaseLock = new ReaderWriterLock(); }
/// <summary> /// Initializes a new instance of the <see cref="DisposableLockGrabber"/> class. /// </summary> /// <param name="rwlock">The rwlock.</param> /// <param name="type">The type.</param> /// <param name="timeoutMilliseconds">The timeout milliseconds.</param> public DisposableLockGrabber(ReaderWriterLock rwlock, ReaderWriterLockSynchronizeType type, int timeoutMilliseconds) { m_rwlock = rwlock; m_type = type; DoLock(timeoutMilliseconds); }
private BlibDb(String path) { FilePath = path; SessionFactory = BlibSessionFactoryFactory.CreateSessionFactory(path, false); DatabaseLock = new ReaderWriterLock(); _progressStatus = new ProgressStatus(string.Empty); }
static SyntaxCatalog() { m_timeoutForSyntaxesLock = TimeSpan.FromSeconds(10); m_syntaxesLock = new ReaderWriterLock(); m_syntaxesByIdOrAlias = new SortedDictionary<string, Syntax>(StringComparer.OrdinalIgnoreCase); m_lockForCatalogLoad = new object(); }
public static bool Init() { try { random = new ThreadSafeRandom(); m_lock = new System.Threading.ReaderWriterLock(); _maps = new Dictionary <int, MapPoint>(); _mapInfos = new Dictionary <int, Map>(); if (!LoadMap(_maps, _mapInfos)) { return(false); } _serverMap = new Dictionary <int, List <int> >(); if (!InitServerMap(_serverMap)) { return(false); } } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("MapMgr", e); } return(false); } return(true); }
/// <summary> /// 创建日志文件 /// </summary> private void CreatLog() { TextWriter logwrite = null; var writelock = new ReaderWriterLock(); try { writelock.AcquireWriterLock(-1); var directoryInfo = m_fileinfo.Directory; if (directoryInfo != null && !directoryInfo.Exists) { var directory = m_fileinfo.Directory; if (directory != null) directory.Create(); } logwrite = TextWriter.Synchronized(m_fileinfo.CreateText()); logwrite.WriteLine("#------------------------------------------------------"); logwrite.WriteLine("# SYSTEM LOG "); logwrite.WriteLine("# "); logwrite.WriteLine("# Create at " + DateTime.Now.ToString(CultureInfo.InvariantCulture) + " "); logwrite.WriteLine("# "); logwrite.WriteLine("#------------------------------------------------------"); logwrite.Close(); } catch (Exception ex) { throw new Exception("创建系统日志文件出错!" + ex); } finally { writelock.ReleaseWriterLock(); if (logwrite != null) { logwrite.Close(); } } }
internal HttpApplicationState () { // do not use the public (empty) ctor as it required UnmanagedCode permission _AppObjects = new HttpStaticObjectsCollection (this); _SessionObjects = new HttpStaticObjectsCollection (this); _Lock = new ReaderWriterLock (); }
public RaidInstanceStore() { _loaded = false; _cache = new List<RaidInstance>(); _lock = new ReaderWriterLock(); }
public Cache () { _nItems = 0; _lockEntries = new ReaderWriterLock (); _arrEntries = new Hashtable (); _objExpires = new CacheExpires (this); }
/// <summary> /// Constructor /// </summary> /// <param name="info"></param> public Scene(ServerInfo info) { _info = info; _info.Online = 0; _info.State = 2; _players = new Dictionary<int, GamePlayer>(); _locker = new ReaderWriterLock(); }
static EventSource() { EventSource.eventSources = new ArrayList(); EventSource.shutdownInProgress = 0; EventSource.preventShutdownLock = new ReaderWriterLock(); AppDomain.CurrentDomain.ProcessExit += new EventHandler(EventSource.ProcessExit); AppDomain.CurrentDomain.DomainUnload += new EventHandler(EventSource.ProcessExit); }
public ReaderWriterObjectLocker() { // TODO: update to ReaderWriterLockSlim on .net 3.5 locker = new ReaderWriterLock(); writerReleaser = new WriterReleaser(this); readerReleaser = new ReaderReleaser(this); }
public void Dispose() { if (m_l != null) { m_l.ReleaseWriterLock(); m_l = null; } }
internal ObjectSecurity (CommonSecurityDescriptor securityDescriptor) { if (securityDescriptor == null) throw new ArgumentNullException ("securityDescriptor"); descriptor = securityDescriptor; rw_lock = new ReaderWriterLock (); }
public void TestIsWriterLockHeld () { rwlock = new ReaderWriterLock (); Assert.IsTrue (!rwlock.IsWriterLockHeld, "#1"); rwlock.AcquireWriterLock (500); Assert.IsTrue (rwlock.IsWriterLockHeld, "#2"); RunThread (new ThreadStart (IsWriterLockHeld_2)); rwlock.ReleaseWriterLock (); }
/// <summary> /// .ctor /// </summary> /// <param name="alock">Lock to handle</param> /// <param name="timeout">timeout to acquire lock</param> /// <param name="mode">Lock mode</param> public DisposableReaderWriterLock(ReaderWriterLock alock, TimeSpan timeout, LockMode mode = LockMode.Read) { ParametersValidator.IsNotNull(alock, ()=>alock); _lock = alock; _timeout = timeout; _mode = mode; AcquireLock(); Logger.TraceFormat("lock created timeout={0}, mode ={1}", timeout, mode); }
static SecurityAuthenticationCheckEvent() { string[] counterNames = new string[] { SecurityServiceEvent.Counters[(int)CounterID.AuthenticationCheck].CounterName }; securityEvent = new SecurityAuthenticationCheckEvent(counterNames); writerLock = new ReaderWriterLock(); }
static SecurityProfileLoadEvent() { string[] counterNames = new string[] { SecurityServiceEvent.Counters[(int)CounterID.ProfileLoad].CounterName }; securityEvent = new SecurityProfileLoadEvent(counterNames); writerLock = new ReaderWriterLock(); }
private void Initital() { Reset(); httpClient = new HttpClientHelper(); md5 = new MD5CryptionXG(); cacheParamType = new Dictionary <Type, PropertyInfo[]>(10); lockrw = new ReaderWriterLock(); httpClient.Encoding = encoder; }
virtual protected void InitMember() { m_StopPrivilege = new System.Threading.ReaderWriterLock(); m_OMCAddresses = new Dictionary <string, string>(); m_OMCInfo = new Dictionary <string, string>(); LogReceived += new LogHandler(DBAdapterBase_LogReceived); StateChanged += new StateChangeHandler(DBAdapterBase_StateChanged); m_TimerMaintenance = new System.Timers.Timer(3540 * 1000); // 59分钟运行一次的维护定时器 m_TimerMaintenance.Elapsed += new System.Timers.ElapsedEventHandler(m_TimerMaintenance_Elapsed); }
public PSMoveSharpCameraFrameState() { camera_frame_state_rwl = new ReaderWriterLock(); full_image = new Bitmap(ImageWidth, ImageHeight); using (Graphics gfx = Graphics.FromImage(full_image)) using (SolidBrush brush = new SolidBrush(Color.FromArgb(0, 255, 255))) { gfx.FillRectangle(brush, 0, 0, ImageWidth, ImageHeight); } camera_frame_state_collector = new PSMoveSharpCameraFrameStateCollector(); }
public PSMoveSharpCameraFrameState() { camera_frame_state_rwl = new ReaderWriterLock(); //full_image = new List<byte[]>(); /* * using (Graphics gfx = Graphics.FromImage(full_image)) * using (SolidBrush brush = new SolidBrush(Color.FromArgb(0, 255, 255))) * { * gfx.FillRectangle(brush, 0, 0, ImageWidth, ImageHeight); * } */ camera_frame_state_collector = new PSMoveSharpCameraFrameStateCollector(); }
/// <summary> /// Initialize the spreadsheet. /// </summary> public Spreadsheet(IContainer iContainer) { // Add this spreadsheet to the list of objects in the container. When the container is destroyed, all the components, // including this one, will be disposed of as well. iContainer.Add(this); // These objects provide sorting and filtering for the rows and columns. this.spreadsheetRowView = new SpreadsheetRowView(this); this.spreadsheetColumnView = new SpreadsheetColumnView(this); // This table contains the styles. this.styleTable = new Dictionary <string, Style>(); // This list is used for all the cells that have been animated. At regular intervals, the style on the cells in this // list is changed to make it appear to be changing. See the 'AnimationThread' for the usage. this.animatedList = new AnimatedList(); // These are the initial dimensions of the spreadsheet and the header. this.displayRectangle = Rectangle.Empty; this.headerRectangle = Rectangle.Empty; this.broadcastDataSize = Size.Empty; // This lock is used to coordinate input and output from the this data structure. The document can be read from any // number of threads, but when the data model is changed (written to), other threads must be prevented from reading // intermediate results. this.readerWriterLock = new ReaderWriterLock(); // This flag is used to terminate the background thread used to animate cells that have changed. When set to false the // background thread will exit. this.isAnimationRunning = true; #if DEBUG // Disable the background threads when in the design mode. They will kill the designer. if (LicenseManager.UsageMode != LicenseUsageMode.Designtime) { #endif // This thread will refresh the document from the background. That is, all the hard work is done in the background. // Delegates will be called when the data is actually ready to be put in the control. this.animationThread = new Thread(new ThreadStart(AnimationThread)); this.animationThread.Name = "AnimationThread"; this.animationThread.IsBackground = true; this.animationThread.Start(); #if DEBUG } #endif }
/// <summary> /// Initializes the BallMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _fightRate = new Dictionary <int, FightRateInfo>(); return(LoadFightRate(_fightRate)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("AwardMgr", e); } return(false); } }
public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _allProp = new Dictionary <int, ItemTemplateInfo>(); return(LoadProps(_allProp)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("InitProps", e); } return(false); } }
/// <summary> /// Initializes the StrengthenMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _consortiaLevel = new Dictionary <int, ConsortiaLevelInfo>(); rand = new ThreadSafeRandom(); return(Load(_consortiaLevel)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("ConsortiaLevelMgr", e); } return(false); } }
/// <summary> /// Initializes the BallMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _dailyAward = new Dictionary <int, DailyAwardInfo>(); _dailyAwardState = false; return(LoadDailyAward(_dailyAward)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("AwardMgr", e); } return(false); } }
/// <summary> /// Initializes the BallMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _balls = new Dictionary <int, BallInfo>(); _ballTile = new Dictionary <int, Tile>(); return(LoadBall(_balls, _ballTile)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("BallMgr", e); } return(false); } }
/// <summary> /// Initializes the BallMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _fusions = new Dictionary <string, FusionInfo>(); rand = new ThreadSafeRandom(); return(LoadFusion(_fusions)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("FusionMgr", e); } return(false); } }
public SettingsLoader() { try { this.m_rwlock = new System.Threading.ReaderWriterLock(); if (!System.IO.File.Exists(this.OptionsFile)) { this.Reset(); } else { this.LoadOptions(); } } catch (System.Exception ex) { Program.showErrorMessage(ex.Message); } }
/// <summary> /// Initializes the StrengthenMgr. /// </summary> /// <returns></returns> public static bool Init() { try { m_lock = new System.Threading.ReaderWriterLock(); _strengthens = new Dictionary <int, StrengthenInfo>(); m_Refinery_Strengthens = new Dictionary <int, StrengthenInfo>(); Strengthens_Goods = new Dictionary <int, StrengthenGoodsInfo>(); rand = new ThreadSafeRandom(); return(LoadStrengthen(_strengthens, m_Refinery_Strengthens)); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("StrengthenMgr", e); } return(false); } }
public WorldServer(XmlConfigurationProvider <WorldServerConfiguration> xmlConfigurationProvider) { CLIENTs = new Dictionary <uint, WS_Network.ClientClass>(); CHARACTERs = new Dictionary <ulong, WS_PlayerData.CharacterObject>(); CHARACTERs_Lock = new System.Threading.ReaderWriterLock(); ALLQUESTS = new WS_Quests(); AllGraveYards = new WS_GraveYards(WorldServiceLocator._DataStoreProvider); CreatureQuestStarters = new Dictionary <int, List <int> >(); CreatureQuestFinishers = new Dictionary <int, List <int> >(); GameobjectQuestStarters = new Dictionary <int, List <int> >(); GameobjectQuestFinishers = new Dictionary <int, List <int> >(); WORLD_CREATUREs_Lock = new System.Threading.ReaderWriterLock(); WORLD_CREATUREs = new Dictionary <ulong, WS_Creatures.CreatureObject>(); WORLD_CREATUREsKeys = new ArrayList(); WORLD_GAMEOBJECTs = new Dictionary <ulong, WS_GameObjects.GameObject>(); WORLD_CORPSEOBJECTs = new Dictionary <ulong, WS_Corpses.CorpseObject>(); WORLD_DYNAMICOBJECTs_Lock = new System.Threading.ReaderWriterLock(); WORLD_DYNAMICOBJECTs = new Dictionary <ulong, WS_DynamicObjects.DynamicObject>(); WORLD_TRANSPORTs_Lock = new System.Threading.ReaderWriterLock(); WORLD_TRANSPORTs = new Dictionary <ulong, WS_Transports.TransportObject>(); WORLD_ITEMs = new Dictionary <ulong, ItemObject>(); ITEMDatabase = new Dictionary <int, WS_Items.ItemInfo>(); CREATURESDatabase = new Dictionary <int, CreatureInfo>(); GAMEOBJECTSDatabase = new Dictionary <int, WS_GameObjects.GameObjectInfo>(); itemGuidCounter = WorldServiceLocator._Global_Constants.GUID_ITEM; CreatureGUIDCounter = WorldServiceLocator._Global_Constants.GUID_UNIT; GameObjectsGUIDCounter = WorldServiceLocator._Global_Constants.GUID_GAMEOBJECT; CorpseGUIDCounter = WorldServiceLocator._Global_Constants.GUID_CORPSE; DynamicObjectsGUIDCounter = WorldServiceLocator._Global_Constants.GUID_DYNAMICOBJECT; TransportGUIDCounter = WorldServiceLocator._Global_Constants.GUID_MO_TRANSPORT; Log = new BaseWriter(); PacketHandlers = new Dictionary <Opcodes, HandlePacket>(); Rnd = new Random(); AccountDatabase = new SQL(); CharacterDatabase = new SQL(); WorldDatabase = new SQL(); this.xmlConfigurationProvider = xmlConfigurationProvider; }
/// <summary> /// Create a table of in-memory data. /// </summary> /// <param name="name"></param> public Table() { // Initialize the object. this.IsPersistent = true; this.Columns = new ColumnCollection(base.Columns); this.Rows = new RowCollection(this, base.Rows); this.ChildRelations = new RelationCollection(base.ChildRelations); this.ParentRelations = new RelationCollection(base.ParentRelations); this.Indices = new List <Index>(); this.ReaderWriterLock = new ReaderWriterLock(); // IMPORTANT CONCEPT: All rows have a row version which is used to reconcile the client data model with the server // data model. When the row version of a server row is newer than the row version on the client, that record and only // that record is transmitted to the client. In this way, the client data model is reconciled to the server data model // with a minimum amount of traffic between the two. this.RowVersionColumn = new Column("RowVersion", typeof(long), string.Empty, MappingType.Attribute); this.RowVersionColumn.IsPersistent = true; this.Columns.Add(this.RowVersionColumn); // The 'Indicies' is a subset of the constraint collection. It is often clumsy to search all the constraints looking // for just an index, so a list of just the indices is maintained through this event handler. this.Constraints.CollectionChanged += new System.ComponentModel.CollectionChangeEventHandler(Constraints_CollectionChanged); }
/// <summary> /// 通用输出并记录,主线程 /// </summary> /// <param name="message"></param> public static void OutputAndSaveTxt(string message) { if (!File.Exists(Path.Combine(TheBasePath, "Alloutput.txt"))) { File.Create(Path.Combine(TheBasePath, "Alloutput.txt")); } ReaderWriterLock rwl = new System.Threading.ReaderWriterLock(); lock (objectLock) { rwl.AcquireWriterLock(1000); Thread.Sleep(new Random().Next(1000, 2000)); Console.WriteLine(message); File.AppendAllLines(Path.Combine(TheBasePath, "Alloutput.txt"), new List <string>() { message }); //File.AppendAllText(Path.Combine(TheBasePath, "Alloutput.txt"), message); Thread.Sleep(new Random().Next(1000, 2000)); rwl.ReleaseWriterLock(); } }
internal OletxTransactionManager( string nodeName ) { lock ( ClassSyncObject ) { // If we have not already initialized the shim factory and started the notification // thread, do so now. if (null == OletxTransactionManager.proxyShimFactory) { Int32 error = NativeMethods.GetNotificationFactory( OletxTransactionManager.ShimWaitHandle.SafeWaitHandle, out OletxTransactionManager.proxyShimFactory ); if (0 != error) { throw TransactionException.Create(SR.GetString(SR.TraceSourceOletx), SR.GetString(SR.UnableToGetNotificationShimFactory), null); } ThreadPool.UnsafeRegisterWaitForSingleObject( OletxTransactionManager.ShimWaitHandle, new WaitOrTimerCallback(OletxTransactionManager.ShimNotificationCallback), null, -1, false ); } } this.dtcTransactionManagerLock = new ReaderWriterLock(); this.nodeNameField = nodeName; // The DTC proxy doesn't like an empty string for node name on 64-bit platforms when // running as WOW64. It treats any non-null node name as a "remote" node and turns off // the WOW64 bit, causing problems when reading the registry. So if we got on empty // string for the node name, just treat it as null. if ((null != this.nodeNameField) && (0 == this.nodeNameField.Length)) { this.nodeNameField = null; } if (DiagnosticTrace.Verbose) { DistributedTransactionManagerCreatedTraceRecord.Trace(SR.GetString(SR.TraceSourceOletx), this.GetType(), this.nodeNameField ); } // Initialize the properties from config. configuredTransactionOptions.IsolationLevel = isolationLevelProperty = TransactionManager.DefaultIsolationLevel; configuredTransactionOptions.Timeout = timeoutProperty = TransactionManager.DefaultTimeout; this.internalResourceManager = new OletxInternalResourceManager(this); dtcTransactionManagerLock.AcquireWriterLock(-1); try { this.dtcTransactionManager = new DtcTransactionManager(this.nodeNameField, this); } finally { dtcTransactionManagerLock.ReleaseWriterLock(); } if (resourceManagerHashTable == null) { resourceManagerHashTable = new Hashtable(2); resourceManagerHashTableLock = new System.Threading.ReaderWriterLock(); } }
public static bool Init() { m_lock = new System.Threading.ReaderWriterLock(); FilePath = Directory.GetCurrentDirectory() + @"\macrodrop\macroDrop.ini"; return(Reload()); }
/// <summary> /// Creates a row. /// </summary> /// <param name="dataRowBuilder">The System.Data.DataRowBuilder type supports the .NET Framework and is not intended to be /// used directly by your code.</param> public Row(System.Data.DataRowBuilder dataRowBuilder) : base(dataRowBuilder) { // Initialize the object. this.ReaderWriterLock = new ReaderWriterLock(); }
public static bool Init() { m_lock = new System.Threading.ReaderWriterLock(); return(ReLoad()); }
public LockQueue(ReaderWriterLock rwlock) { this.rwlock = rwlock; }
/// <summary> /// constructor /// </summary> public TSystemDefaultsCache() : base() { FTableCached = false; FReadWriteLock = new System.Threading.ReaderWriterLock(); }
public WriterLock(ReaderWriterLock @lock) { _lock = @lock; _lock.AcquireWriterLock(Timeout.Infinite); }
public CommandQueue() { _lock = new System.Threading.ReaderWriterLock(); _commands = new List <Command>(); }