コード例 #1
0
        //[OgreVersion(1, 7, 2)]
        protected RequestID AddRequest(ResourceRequest req)
        {
            WorkQueue queue     = Root_Instance_WorkQueue;
            RequestID requestID = queue.AddRequest(this.workQueueChannel, (ushort)req.Type, req);

            this.outstandingRequestSet.Add(requestID);
            return(requestID);
        }
コード例 #2
0
ファイル: WorkQueue.cs プロジェクト: RainsSoft/UAxiom3D-Lib
 /// <summary>
 /// Constructor
 /// </summary>
 ////[OgreVersion(1, 7, 2)]
 public Request(ushort channel, ushort rtype, object rData, byte retry, RequestID rid)
 {
     this._channel    = channel;
     this._type       = rtype;
     this._data       = rData;
     this._retryCount = retry;
     this._id         = rid;
     this._aborted    = false;
 }
コード例 #3
0
        public override void AbortRequest(RequestID id)
        {
            // NOTE: Pending requests are exist any of RequestQueue, ProcessQueue and
            // ResponseQueue when keeping ProcessMutex, so we check all of these queues.

            lock ( processMutex )
            {
                foreach (var i in this.processQueue)
                {
                    if (i.ID == id)
                    {
                        i.AbortRequest();
                        break;
                    }
                }
            }

            lock ( requestMutex )
            {
                foreach (var i in this.requestQueue)
                {
                    if (i.ID == id)
                    {
                        i.AbortRequest();
                        break;
                    }
                }
            }

            lock ( responseMutex )
            {
                foreach (var i in this.responseQueue)
                {
                    if (i.Request.ID == id)
                    {
                        i.AbortRequest();
                        break;
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Put a Request on the queue with a specific RequestID.
        /// </summary>
        //[OgreVersion(1, 7, 2)]
        protected void AddRequestWithRID(RequestID rid, ushort channel, ushort requestType, object rData, byte retryCount)
        {
            // lock to push request to the queue
            lock (requestMutex) {
                if (this.shuttingDown)
                {
                    return;
                }

                var req = new Request(channel, requestType, rData, retryCount, rid);

                LogManager.Instance.Write(LogMessageLevel.Trivial, false,
                                          "DefaultWorkQueueBase('{0}') - REQUEUED(thread:{1}): ID={2} channel={3} requestType={4}",
                                          this.name, GetThreadName(), rid, channel, requestType);

#if AXIOM_THREAD_SUPPORT
                requestQueue.Add(req);
                NotifyWorkers();
#else
                ProcessRequestResponse(req, true);
#endif
            }
        }
コード例 #5
0
        /// <see cref="WorkQueue.AbortRequest"/>
        //[OgreVersion(1, 7, 2)]
        public override void AbortRequest(RequestID id) {
            // NOTE: Pending requests are exist any of RequestQueue, ProcessQueue and
            // ResponseQueue when keeping ProcessMutex, so we check all of these queues.

            lock (processMutex) {
                foreach (var i in this.processQueue) {
                    if (i.ID == id) {
                        i.AbortRequest();
                        break;
                    }
                }
            }

            lock (requestMutex) {
                foreach (var i in this.requestQueue) {
                    if (i.ID == id) {
                        i.AbortRequest();
                        break;
                    }
                }
            }

            lock (responseMutex) {
                foreach (var i in this.responseQueue) {
                    if (i.Request.ID == id) {
                        i.AbortRequest();
                        break;
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Put a Request on the queue with a specific RequestID.
        /// </summary>
        //[OgreVersion(1, 7, 2)]
        protected void AddRequestWithRID(RequestID rid, ushort channel, ushort requestType, object rData, byte retryCount) {
            // lock to push request to the queue
            lock (requestMutex) {
                if (this.shuttingDown) {
                    return;
                }

                var req = new Request(channel, requestType, rData, retryCount, rid);

                LogManager.Instance.Write(LogMessageLevel.Trivial, false,
                                           "DefaultWorkQueueBase('{0}') - REQUEUED(thread:{1}): ID={2} channel={3} requestType={4}",
                                           this.name, GetThreadName(), rid, channel, requestType);

#if AXIOM_THREAD_SUPPORT
				requestQueue.Add( req );
				NotifyWorkers();
#else
                ProcessRequestResponse(req, true);
#endif
            }
        }
コード例 #7
0
ファイル: WorkQueue.cs プロジェクト: ryan-bunker/axiom3d
		public abstract void AbortRequest( RequestID id );
コード例 #8
0
ファイル: WorkQueue.cs プロジェクト: ryan-bunker/axiom3d
			public Request( ushort channel, ushort rtype, object rData, byte retry, RequestID rid )
			{
				this._channel = channel;
				this._type = rtype;
				this._data = rData;
				this._retryCount = retry;
				this._id = rid;
				this._aborted = false;
			}
コード例 #9
0
        /// <summary>
        /// Aborts background process.
        /// </summary>
        //[OgreVersion(1, 7, 2)]
        public void AbortRequest(RequestID ticket)
        {
            WorkQueue queue = Root_Instance_WorkQueue;

            queue.AbortRequest(ticket);
        }
コード例 #10
0
 /// <summary>
 /// Returns whether a previously queued process has completed or not.
 /// </summary>
 /// <remarks>
 /// This method of checking that a background process has completed is
 /// the 'polling' approach. Each queued method takes an optional listener
 /// parameter to allow you to register a callback instead, which is
 /// arguably more efficient.
 /// @note
 /// Tickets are not stored once complete so do not accumulate over time.
 /// This is why a non-existent ticket will return 'true'.
 /// </remarks>
 /// <param name="ticket">The ticket which was returned when the process was queued</param>
 /// <returns>true if process has completed (or if the ticket is unrecognised), false otherwise</returns>
 //[OgreVersion(1, 7, 2)]
 public virtual bool IsProcessComplete(RequestID ticket)
 {
     return(!this.outstandingRequestSet.Contains(ticket));
 }
コード例 #11
0
ファイル: WorkQueue.cs プロジェクト: RainsSoft/UAxiom3D-Lib
 /// <summary>
 /// Abort a previously issued request.
 /// If the request is still waiting to be processed, it will be
 /// removed from the queue.
 /// </summary>
 /// <param name="id">The ID of the previously issued request.</param>
 ////[OgreVersion(1, 7, 2)]
 public abstract void AbortRequest(RequestID id);