Ejemplo n.º 1
0
        private void enqueueEvents(Drawable child, LifetimeState oldState, LifetimeState newState)
        {
            Debug.Assert(oldState != newState);

            switch (oldState)
            {
            case LifetimeState.Future:
                eventQueue.Enqueue(new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.Start, LifetimeBoundaryCrossingDirection.Forward));
                if (newState == LifetimeState.Past)
                {
                    eventQueue.Enqueue(new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.End, LifetimeBoundaryCrossingDirection.Forward));
                }
                break;

            case LifetimeState.Current:
                eventQueue.Enqueue(newState == LifetimeState.Past
                        ? new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.End, LifetimeBoundaryCrossingDirection.Forward)
                        : new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.Start, LifetimeBoundaryCrossingDirection.Backward));
                break;

            case LifetimeState.Past:
                eventQueue.Enqueue(new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.End, LifetimeBoundaryCrossingDirection.Backward));
                if (newState == LifetimeState.Future)
                {
                    eventQueue.Enqueue(new LifetimeBoundaryCrossedEvent(child, LifetimeBoundaryKind.Start, LifetimeBoundaryCrossingDirection.Backward));
                }
                break;
            }
        }
Ejemplo n.º 2
0
 public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     lock (this.ThisLock)
     {
         this.ThrowIfNotOpened();
         this.state = LifetimeState.Closing;
     }
     return(this.OnBeginClose(timeout, callback, state));
 }
 public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
 {
     lock (this.ThisLock)
     {
         this.ThrowIfNotOpened();
         this.state = LifetimeState.Closing;
     }
     return this.OnBeginClose(timeout, callback, state);
 }
Ejemplo n.º 4
0
 public void Close(TimeSpan timeout)
 {
     lock (this.ThisLock)
     {
         this.ThrowIfNotOpened();
         this.state = LifetimeState.Closing;
     }
     this.OnClose(timeout);
     this.state = LifetimeState.Closed;
 }
 public void Close(TimeSpan timeout)
 {
     lock (this.ThisLock)
     {
         this.ThrowIfNotOpened();
         this.state = LifetimeState.Closing;
     }
     this.OnClose(timeout);
     this.state = LifetimeState.Closed;
 }
Ejemplo n.º 6
0
        public void Close(TimeSpan timeout)
        {
            lock (ThisLock)
            {
                ThrowIfNotOpened();
                _state = LifetimeState.Closing;
            }

            OnClose(timeout);
            _state = LifetimeState.Closed;
        }
Ejemplo n.º 7
0
        public async Task CloseAsync(CancellationToken token)
        {
            token.ThrowIfCancellationRequested();
            lock (ThisLock)
            {
                ThrowIfNotOpened();
                _state = LifetimeState.Closing;
            }

            await OnCloseAsync(token);

            _state = LifetimeState.Closed;
        }
Ejemplo n.º 8
0
        public void Abort()
        {
            lock (this.ThisLock)
            {
                if (this.State == LifetimeState.Closed || _aborted)
                    return;
                _aborted = true;
                _state = LifetimeState.Closing;
            }

            this.OnAbort();
            _state = LifetimeState.Closed;
        }
Ejemplo n.º 9
0
 public void Abort()
 {
     lock (this.ThisLock)
     {
         if ((this.State == LifetimeState.Closed) || this.aborted)
         {
             return;
         }
         this.aborted = true;
         this.state   = LifetimeState.Closing;
     }
     this.OnAbort();
     this.state = LifetimeState.Closed;
 }
 public void Abort()
 {
     lock (this.ThisLock)
     {
         if ((this.State == LifetimeState.Closed) || this.aborted)
         {
             return;
         }
         this.aborted = true;
         this.state = LifetimeState.Closing;
     }
     this.OnAbort();
     this.state = LifetimeState.Closed;
 }
Ejemplo n.º 11
0
        private SortedSet <ChildEntry> futureOrPastChildren(LifetimeState state)
        {
            switch (state)
            {
            case LifetimeState.Future:
                return(futureChildren);

            case LifetimeState.Past:
                return(pastChildren);

            default:
                return(null);
            }
        }
Ejemplo n.º 12
0
        public void Abort()
        {
            lock (ThisLock)
            {
                if (State == LifetimeState.Closed || _aborted)
                {
                    return;
                }
                _aborted = true;
                _state   = LifetimeState.Closing;
            }

            OnAbort();
            _state = LifetimeState.Closed;
        }
        public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            lock (this.ThisLock)
            {
                this.ThrowIfNotOpened();
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                {
                    closeStack = new StackTrace();
                }
#endif
                this.state = LifetimeState.Closing;
            }

            return(this.OnBeginClose(timeout, callback, state));
        }
Ejemplo n.º 14
0
        public void Abort()
        {
            lock (this.ThisLock)
            {
                if (this.State == LifetimeState.Closed || this.aborted)
                    return;
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                    closeStack = new StackTrace();
#endif
                this.aborted = true;
                this.state = LifetimeState.Closing;
            }

            this.OnAbort();
            this.state = LifetimeState.Closed;
        }
        public void Close(TimeSpan timeout)
        {
            lock (this.ThisLock)
            {
                this.ThrowIfNotOpened();
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                {
                    closeStack = new StackTrace();
                }
#endif
                this.state = LifetimeState.Closing;
            }

            this.OnClose(timeout);
            this.state = LifetimeState.Closed;
        }
        public void Abort()
        {
            lock (this.ThisLock)
            {
                if (this.State == LifetimeState.Closed || this.aborted)
                {
                    return;
                }
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                {
                    closeStack = new StackTrace();
                }
#endif
                this.aborted = true;
                this.state   = LifetimeState.Closing;
            }

            this.OnAbort();
            this.state = LifetimeState.Closed;
        }
Ejemplo n.º 17
0
 public void EndClose(IAsyncResult result)
 {
     OnEndClose(result);
     _state = LifetimeState.Closed;
 }
Ejemplo n.º 18
0
 public LifetimeManager(object mutex)
 {
     _mutex = mutex;
     _state = LifetimeState.Opened;
 }
Ejemplo n.º 19
0
        /// <summary>To be documented.</summary>
        public readonly void LifetimeStateUpdated(LifetimeState NewState)
        {
            var @this = (ID3D12LifetimeOwner *)Unsafe.AsPointer(ref Unsafe.AsRef(in this));

            ((delegate * unmanaged[Cdecl] < ID3D12LifetimeOwner *, LifetimeState, void >)LpVtbl[3])(@this, NewState);
        }
Ejemplo n.º 20
0
        public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
        {
            lock (this.ThisLock)
            {
                this.ThrowIfNotOpened();
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                    closeStack = new StackTrace();
#endif
                this.state = LifetimeState.Closing;
            }

            return this.OnBeginClose(timeout, callback, state);
        }
Ejemplo n.º 21
0
 public LifetimeManager(object mutex)
 {
     this.mutex = mutex;
     this.state = LifetimeState.Opened;
 }
Ejemplo n.º 22
0
 public void EndClose(IAsyncResult result)
 {
     this.OnEndClose(result);
     _state = LifetimeState.Closed;
 }
Ejemplo n.º 23
0
 public LifetimeManager(object mutex)
 {
     _mutex = mutex;
     _state = LifetimeState.Opened;
 }
Ejemplo n.º 24
0
 public void Next()
 {
     this.CurrentState = this.NextState;
     this.NextState    = LifetimeState.Unchanged;
 }
Ejemplo n.º 25
0
 public LifetimeManager(object mutex)
 {
     ThisLock = mutex;
     _state   = LifetimeState.Opened;
 }
 public LifetimeManager(object mutex)
 {
     this.mutex = mutex;
     this.state = LifetimeState.Opened;
 }
 public void EndClose(IAsyncResult result)
 {
     this.OnEndClose(result);
     this.state = LifetimeState.Closed;
 }
Ejemplo n.º 28
0
 public void Change()
 => this.NextState = LifetimeState.Changed;
Ejemplo n.º 29
0
        public void Close(TimeSpan timeout)
        {
            lock (this.ThisLock)
            {
                this.ThrowIfNotOpened();
#if DEBUG_EXPENSIVE
                if (closeStack == null)
                    closeStack = new StackTrace();
#endif
                this.state = LifetimeState.Closing;
            }

            this.OnClose(timeout);
            this.state = LifetimeState.Closed;
        }
Ejemplo n.º 30
0
 public void Remove()
 => this.NextState = LifetimeState.Removed;