コード例 #1
0
        public async Task <string> AcquireWriterLockAsync(string name)
        {
            CustomReaderWriterLock crwl;

            lock (this)
            {
                if (_rwls.ContainsKey(name))
                {
                    crwl = _rwls[name];
                }
                else
                {
                    crwl        = new CustomReaderWriterLock();
                    _rwls[name] = crwl;
                }
            }

            return(await crwl.AcquireWriterLockAsync());
        }
コード例 #2
0
        public string AcquireWriterLock(string name)
        {
            CustomReaderWriterLock crwl;

            lock (this)
            {
                if (_rwls.ContainsKey(name))
                {
                    crwl = _rwls[name];
                }
                else
                {
                    crwl        = new CustomReaderWriterLock();
                    _rwls[name] = crwl;
                }
            }

            return(crwl.AcquireWriterLock());
        }