예제 #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;
            }
        }
예제 #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);
 }
예제 #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;
 }
예제 #6
0
        public void Close(TimeSpan timeout)
        {
            lock (ThisLock)
            {
                ThrowIfNotOpened();
                _state = LifetimeState.Closing;
            }

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

            await OnCloseAsync(token);

            _state = LifetimeState.Closed;
        }
예제 #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;
        }
예제 #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;
 }
예제 #11
0
        private SortedSet <ChildEntry> futureOrPastChildren(LifetimeState state)
        {
            switch (state)
            {
            case LifetimeState.Future:
                return(futureChildren);

            case LifetimeState.Past:
                return(pastChildren);

            default:
                return(null);
            }
        }
예제 #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));
        }
예제 #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;
        }
예제 #17
0
 public void EndClose(IAsyncResult result)
 {
     OnEndClose(result);
     _state = LifetimeState.Closed;
 }
예제 #18
0
 public LifetimeManager(object mutex)
 {
     _mutex = mutex;
     _state = LifetimeState.Opened;
 }
예제 #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);
        }
예제 #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);
        }
예제 #21
0
 public LifetimeManager(object mutex)
 {
     this.mutex = mutex;
     this.state = LifetimeState.Opened;
 }
예제 #22
0
 public void EndClose(IAsyncResult result)
 {
     this.OnEndClose(result);
     _state = LifetimeState.Closed;
 }
예제 #23
0
 public LifetimeManager(object mutex)
 {
     _mutex = mutex;
     _state = LifetimeState.Opened;
 }
예제 #24
0
 public void Next()
 {
     this.CurrentState = this.NextState;
     this.NextState    = LifetimeState.Unchanged;
 }
예제 #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;
 }
예제 #28
0
 public void Change()
 => this.NextState = LifetimeState.Changed;
예제 #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;
        }
예제 #30
0
 public void Remove()
 => this.NextState = LifetimeState.Removed;