Пример #1
0
 private void SuppressFinalize()
 {
     if (_finalizer != null)
     {
         _finalizer.Generator = null;
         _LastFinalizer       = _finalizer;
     }
     else
     {
         // We must be on the finalizer thread, and being called from _finalizer.Finalize()
         Debug.Assert(Thread.CurrentThread.Name == null);
     }
 }
Пример #2
0
        internal PythonGenerator(PythonFunction function, Func <MutableTuple, object> /*!*/ next, MutableTuple data)
        {
            _function  = function;
            _next      = next;
            _data      = data;
            _dataTuple = GetDataTuple();
            State      = GeneratorRewriter.NotStarted;

            if (_LastFinalizer == null || (_finalizer = Interlocked.Exchange(ref _LastFinalizer, null)) == null)
            {
                _finalizer = new GeneratorFinalizer(this);
            }
            else
            {
                _finalizer.Generator = this;
            }
        }