Ejemplo n.º 1
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public StringMaker GetSharedStringMaker()
        {
            StringMaker maker = null;

            bool tookLock = false;

            try
            {
                Monitor.Enter(_sharedStatics, ref tookLock);

                if (_sharedStatics._maker != null)
                {
                    maker = _sharedStatics._maker;
                    _sharedStatics._maker = null;
                }
            }
            finally {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }

            if (maker == null)
            {
                maker = new StringMaker();
            }

            return(maker);
        }
Ejemplo n.º 2
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        static public void ReleaseSharedStringMaker(ref StringMaker maker)
        {
            // save this stringmaker so someone else can use it
            bool tookLock = false;

            try
            {
                Monitor.Enter(_sharedStatics, ref tookLock);

                _sharedStatics._maker = maker;
                maker = null;
            }
            finally {
                if (tookLock)
                {
                    Monitor.Exit(_sharedStatics);
                }
            }
        }